org.apache.ojb.broker.util.sequence
Interface SequenceManager

All Known Implementing Classes:
AbstractSequenceManager, SequenceManagerHighLowImpl, SequenceManagerInMemoryImpl, SequenceManagerMSSQLGuidImpl, SequenceManagerNativeImpl, SequenceManagerNextValImpl, SequenceManagerSeqHiLoImpl, SequenceManagerStoredProcedureImpl, SequenceManagerTransientImpl

public interface SequenceManager

SequenceManagers are responsible for creating new unique ID's - unique accross all "extent" object declarations in OJB metadata. There are some standard sequence manager implementations in this package.

SequenceManager objects are obtained from a factory class called SequenceManagerFactory. This Factory can be configured to provide instances of user defined implementors of this interface.

NOTE: SequenceManagers should be aware of "extents" ("extent" is an OJB inheritance feature), that is: if you ask for an uid for an Interface (more exact for one implementor class) with several implementor classes, or a baseclass with several subclasses the returned uid should be unique accross all tables representing objects of the extent in question.

Version:
$Id: SequenceManager.java 365232 2005-12-21 22:36:07Z tomdz $

Method Summary
 void afterStore(JdbcAccess dbAccess, ClassDescriptor cld, java.lang.Object obj)
          This method is called after the object was written to the persistent storage.
 java.lang.Object getUniqueValue(FieldDescriptor field)
          This method is called to get an unique value before the object is written to persistent storage.
 

Method Detail

getUniqueValue

java.lang.Object getUniqueValue(FieldDescriptor field)
                                throws SequenceManagerException
This method is called to get an unique value before the object is written to persistent storage.
Returns a unique object for the given field attribute. The returned value takes in account the jdbc-type and the FieldConversion.sql2java() conversion defined for field. The returned object is unique accross all tables of "extent" classes the field belongs to.
Implementations using native identity columns should return a unique incremented counter object for temporary use by OJB.

Throws:
SequenceManagerException

afterStore

void afterStore(JdbcAccess dbAccess,
                ClassDescriptor cld,
                java.lang.Object obj)
                throws SequenceManagerException
This method is called after the object was written to the persistent storage.
This is to support native Identity columns (auto_increment columns) on the db side. Other implementations may ignore this method.

Parameters:
dbAccess - Current used JdbcAccess instance
cld - Descriptor for specified object
obj - The object to associate with identity value
Throws:
SequenceManagerException


(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30