Persistence::ValueGenerator - Unqiue value generator.
use Persistence::ValueGenerator::TableGenerator; my $generator = Persistence::ValueGenerator::TableGenerator->new( entity_manager => $entity_manager_name, name => 'empno_generator', table => 'seq_generator', primary_key_column_name => 'pk_column', primary_key_column_value => 'empno', value_column => 'value_column', allocation_size => 5, ); my $entity = Persistence::Entity->new( name => 'emp', unique_expression => 'empno', primary_key => ['empno'], columns => [ sql_column(name => 'ename'), sql_column(name => 'empno'), sql_column(name => 'deptno') ], value_generators => {empno => 'empno_generator'}, ); # or # $entity->add_value_generators(empno => 'empno_generator'); $entity_manager->add_entities($entity);
Abstract class for value generator's class.
None
Defines the name of the Persistence::ValueGenerator::TableGenerator instance and is the name referenced in the
Defined how much the counter will be incremented when entity queries the table for a new value, This feature is to cache blocks so that it doesn't have to go to the database every time it needs a new ID.
Stores counter for current seq and allocation_size
Entity manager name
Caches entity manager instance.
Returns generator instance, takes table generator name.
Returns next value for the instance generator
Abstract method retrieve_next_value
Return true if objects holds cached_seq.
Returns entity manager.
Persistence::ValueGenerator::TableGenerator Persistence::ValueGenerator::SequenceGenerator
The Persistence::ValueGenerator module is free software. You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.
Adrian Witas, adrian@webapp.strefa.pl
To install Persistence::Entity, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Persistence::Entity
CPAN shell
perl -MCPAN -e shell install Persistence::Entity
For more information on module installation, please visit the detailed CPAN module installation guide.