org.jpox.store.rdbms.poid
Class SequencePoidGenerator

java.lang.Object
  extended byorg.jpox.store.poid.AbstractPoidGenerator
      extended byorg.jpox.store.poid.AbstractDatastorePoidGenerator
          extended byorg.jpox.store.rdbms.poid.AbstractRDBMSPoidGenerator
              extended byorg.jpox.store.rdbms.poid.SequencePoidGenerator
All Implemented Interfaces:
PoidGenerator, javax.jdo.datastore.Sequence

public final class SequencePoidGenerator
extends AbstractRDBMSPoidGenerator

This generator Sequence uses the "select .nextval from dual", "SELECT nextval('')" strategy. It's recommended to use this generator in databases supporting sequences. SequencePoidGenerator works with numbers, so clients using this Poid must cast the ID to Long

Required properties

Optional properties

Version:
$Revision: 1.5 $

Field Summary
protected static Localiser LOCALISER_RDBMS
           
 
Fields inherited from class org.jpox.store.rdbms.poid.AbstractRDBMSPoidGenerator
connection
 
Fields inherited from class org.jpox.store.poid.AbstractDatastorePoidGenerator
connectionProvider, storeMgr
 
Fields inherited from class org.jpox.store.poid.AbstractPoidGenerator
defaultBlockSize, LOCALISER, name, poidBlock, properties
 
Constructor Summary
SequencePoidGenerator(java.lang.String name, java.util.Properties props)
          Constructor.
 
Method Summary
protected  boolean createRepository()
          Method to create the sequence.
protected  boolean requiresRepository()
          Indicator for whether the generator requires its own repository.
protected  PoidBlock reserveBlock(long size)
          Reserve a block of ids.
 
Methods inherited from class org.jpox.store.rdbms.poid.AbstractRDBMSPoidGenerator
obtainPoidBlock, requiresConnection
 
Methods inherited from class org.jpox.store.poid.AbstractDatastorePoidGenerator
setConnectionProvider, setStoreManager
 
Methods inherited from class org.jpox.store.poid.AbstractPoidGenerator
allocate, current, currentValue, getName, next, nextValue, obtainPoidBlock, reserveBlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER_RDBMS

protected static final Localiser LOCALISER_RDBMS
Constructor Detail

SequencePoidGenerator

public SequencePoidGenerator(java.lang.String name,
                             java.util.Properties props)
Constructor.

Parameters:
name - Symbolic name for the generator
props - Properties controlling the behaviour of the generator
Method Detail

reserveBlock

protected PoidBlock reserveBlock(long size)
Reserve a block of ids.

Specified by:
reserveBlock in class AbstractPoidGenerator
Parameters:
size - Block size
Returns:
The reserved block

requiresRepository

protected boolean requiresRepository()
Indicator for whether the generator requires its own repository. This class needs a repository so returns true.

Overrides:
requiresRepository in class AbstractPoidGenerator
Returns:
Whether a repository is required.

createRepository

protected boolean createRepository()
Method to create the sequence.

Overrides:
createRepository in class AbstractPoidGenerator
Returns:
Whether it was created successfully.


Copyright © -2007 . All Rights Reserved.