org.apache.ojb.broker.util.sequence
Class SequenceManagerNextValImpl

java.lang.Object
  extended by org.apache.ojb.broker.util.sequence.AbstractSequenceManager
      extended by org.apache.ojb.broker.util.sequence.SequenceManagerNextValImpl
All Implemented Interfaces:
SequenceManager
Direct Known Subclasses:
SequenceManagerSeqHiLoImpl

public class SequenceManagerNextValImpl
extends AbstractSequenceManager

This SequenceManager implementation uses database sequence key generation (e.g supported by Oracle, SAP DB, PostgreSQL, ...). This class is responsible for creating new unique ID's.
It is possible to define a sequence-name field-descriptor attribute in the repository file. If such an attribute was not found, the implementation build an extent aware sequence name by its own.
Keep in mind when define a sequence name, that you are responsible to be aware of extents, that is: if you ask for an uid for an interface with several implementor classes, or a baseclass with several subclasses the returned uid have to be unique accross all tables representing objects of the extent in question. Thus you have to use the same sequence-name for all extents.

Implementation configuration properties:

Property Key Property Values
autoNaming Default was 'true'. If set 'true' OJB try to build a sequence name automatic if none found in field-descriptor and set this generated name as sequence-name in field-descriptor.
If set 'false' OJB throws an exception if none sequence name was found in field-descriptor, ditto OJB does NOT try to create a database sequence entry when for given sequence name no database sequence could be found.

Limitations:



Version:
$Id: SequenceManagerNextValImpl.java,v 1.1 2007-08-24 22:17:29 ewestfal Exp $
Author:
Edson Carlos Ericksson Richter, Rajeev Kaul, Thomas Mahler, Armin Waibel

Field Summary
private  Logger log
           
 
Fields inherited from class org.apache.ojb.broker.util.sequence.AbstractSequenceManager
GLOBAL_SEQUENCE_NAME, PROPERTY_AUTO_NAMING
 
Constructor Summary
SequenceManagerNextValImpl(PersistenceBroker broker)
           
 
Method Summary
protected  long buildNextSequence(ClassDescriptor cld, String sequenceName)
           
protected  void createSequence(ClassDescriptor cld, String sequenceName)
           
protected  int getUniqueId(FieldDescriptor field)
          returns a unique int value for class clazz and field fieldName.
protected  long getUniqueLong(FieldDescriptor field)
          returns a unique long value for class clazz and field fieldName.
 
Methods inherited from class org.apache.ojb.broker.util.sequence.AbstractSequenceManager
afterStore, calculateSequenceName, getBrokerForClass, getConfigurationProperties, getConfigurationProperty, getPlatform, getUniqueValue, setConfigurationProperties, setConfigurationProperty, setReferenceFKs, useAutoNaming
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private Logger log
Constructor Detail

SequenceManagerNextValImpl

public SequenceManagerNextValImpl(PersistenceBroker broker)
Method Detail

getUniqueId

protected int getUniqueId(FieldDescriptor field)
                   throws SequenceManagerException
returns a unique int value for class clazz and field fieldName. the returned number is unique accross all tables in the extent of clazz.

Throws:
SequenceManagerException

getUniqueLong

protected long getUniqueLong(FieldDescriptor field)
                      throws SequenceManagerException
returns a unique long value for class clazz and field fieldName. the returned number is unique accross all tables in the extent of clazz.

Specified by:
getUniqueLong in class AbstractSequenceManager
Throws:
SequenceManagerException

buildNextSequence

protected long buildNextSequence(ClassDescriptor cld,
                                 String sequenceName)
                          throws Exception
Throws:
Exception

createSequence

protected void createSequence(ClassDescriptor cld,
                              String sequenceName)
                       throws Exception
Throws:
Exception


Copyright © 2007-2012 The Kuali Foundation. All Rights Reserved.