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

All Known Implementing Classes:
AbstractSequenceManager, SequenceManagerMySQLImpl

public interface SequenceManager

SequenceManagers are responsible for creating new unique ID's - unique accross all extent objects. There are some standard sequence manager implementations in this package. SequenceManager objects are obtained from a Factory called SequenceManagerFactory. This Factory can be configured to provide instances of user defined implementors of this interface. SequenceManagers should be aware of extents, 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,v 1.10 2004/04/04 23:53:38 brianm Exp $
Author:
Thomas Mahler, Armin Waibel

Method Summary
 void afterStore(JdbcAccess dbAccess, ClassDescriptor cld, java.lang.Object obj)
          This is to support auto_increment columns on the db side
 java.lang.Object getUniqueValue(FieldDescriptor field)
          Returns a unique object for the given field attribute.
 void setReferenceFKs(java.lang.Object obj, ClassDescriptor cld)
          This is used for database auto_increment/identity columns to set the reference foreign keys after they've been assigned by the db.
 

Method Detail

getUniqueValue

public java.lang.Object getUniqueValue(FieldDescriptor field)
                                throws SequenceManagerException
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 in the extent of class the field belongs to.

Throws:
SequenceManagerException

afterStore

public void afterStore(JdbcAccess dbAccess,
                       ClassDescriptor cld,
                       java.lang.Object obj)
                throws SequenceManagerException
This is to support auto_increment columns on the db side

high/low and other implementations may ignore this method.

Travis Reeder

Parameters:
cld -
obj -
Throws:
SequenceManagerException

setReferenceFKs

public void setReferenceFKs(java.lang.Object obj,
                            ClassDescriptor cld)
                     throws SequenceManagerException
This is used for database auto_increment/identity columns to set the reference foreign keys after they've been assigned by the db.

This can be ignored by high/low implementations

Travis Reeder

Parameters:
obj -
cld -
Throws:
SequenceManagerException


(C) 2002 - 2004 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.0, 2004-06-25