NAME
Gestinanna::POF::Alzabo - Support for persistant objects stored in Alzabo
SYNOPSIS
Gestinanna::POF::Alzabo -> build_object_class(
class => 'My::DataObject::Base',
params => {
table => 'SQLTablename',
}
);
package My::DataObject;
use base q(My::DataObject::Base);
# any column access method overrides here
sub column1 {
my $self = shift;
if( @_ ) { # setting
# do checks here, returning or throwing an exception if
# there is a problem
}
$self -> SUPER::column1(@_);
}
DESCRIPTION
This provides the basis for using an RDBMS as an object store via Alzabo. Do not use this for complex objects using relationships and normalization (yet). This is best used for simple types where each object can be a row in a table.
Object Ids
Given an object in this class, the Alzabo row object can be retrieved from the table with
$row = $table -> row_by_id($object -> object_id);
The object id is identical to the string returned by the id_as_string
method of the Alzabo::Runtime::Row class. It is easiest if this corresponds to only one column in the table.
If there is only one column in the primary key, then the object_id is the unmodified value of that column.
Primary Keys
Primary keys are read-only. They may be specified at object creation/loading time (see below for details).
ATTRIBUTES
The attributes are those columns in the table. Primary key attributes are read-only. They may be specified at object creation time in the factory method call.
For example,
$object = $factory -> new( object => (
primary_key_1 => $value1,
primary_key_2 => $value2
);
This will create a new object with the specified primary key values. The object will be stored in the RDBMS when the save
method is called (or when the object is destroyed if Commit
is true).
DATA CONNECTIONS
This module expects an Alzabo schema from the factory. Providing this at the time the factory is created is sufficient.
$factory = Gestinanna::POF -> new(_factory => (
schema => $alzabo_schema
) );
AUTHOR
James Smith, <jsmith@cpan.org>
COPYRIGHT
Copyright (C) 2002, 2003 Texas A&M University. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.