org.apache.ojb.broker
Interface IdentityFactory

All Known Implementing Classes:
IdentityFactoryImpl

public interface IdentityFactory

Builds Identity objects to identify persistence capable objects within OJB. In many cases the primary key (based on metadata declaration) of an object is known and the whole object should be materialized (e.g. findByPrimaryKey(...) calls). This class make available a bunch of methods help to create Identity objects based on

NOTE:
It is possible to assign new created objects with a valid UID before they are written to database - more info see Identity. This should be used with care, because not all SequenceManager implementations returns the "real" UID value before the object was stored (e.g. when database based Identity columns were used a temporary placeholder was returned).

Version:
$Id: IdentityFactory.java,v 1.2.2.1 2004/07/27 00:26:05 arminw Exp $
Author:
Armin Waibel

Method Summary
 Identity buildIdentity(java.lang.Class realClass, java.lang.Class topLevelClass, java.lang.String[] pkFieldName, java.lang.Object[] pkValues)
          Build a unique Identity for the given primary key values (composite PK's) of a persistence capable object.
 Identity buildIdentity(ClassDescriptor cld, java.lang.Object obj)
          Build a unique Identity for the given persistence capable object.
 Identity buildIdentity(java.lang.Class realClass, java.lang.Object pkValue)
          Convenience method for persistent objects with single primary key.
 Identity buildIdentity(java.lang.Class realClass, java.lang.String[] fieldName, java.lang.Object[] pkValues)
          Convenience method for buildIdentity(java.lang.Class, java.lang.Class, java.lang.String[], java.lang.Object[])
 Identity buildIdentity(java.lang.Object obj)
          Build a unique Identity for the given persistence capable object.
 

Method Detail

buildIdentity

public Identity buildIdentity(java.lang.Object obj)
Build a unique Identity for the given persistence capable object.

Parameters:
obj - The object to build the Identity for.
Returns:
The a new created Identity object.

buildIdentity

public Identity buildIdentity(ClassDescriptor cld,
                              java.lang.Object obj)
Build a unique Identity for the given persistence capable object.

Parameters:
cld - The ClassDescriptor of the object.
obj - The object to build the Identity for.
Returns:
The a new created Identity object.

buildIdentity

public Identity buildIdentity(java.lang.Class realClass,
                              java.lang.Class topLevelClass,
                              java.lang.String[] pkFieldName,
                              java.lang.Object[] pkValues)
Build a unique Identity for the given primary key values (composite PK's) of a persistence capable object.

Parameters:
realClass - The class of the associated object.
topLevelClass - The top-level class of the associated object.
pkFieldName - The field names of the PK fields.
pkValues - The PK values.
Returns:
The a new created Identity object.

buildIdentity

public Identity buildIdentity(java.lang.Class realClass,
                              java.lang.String[] fieldName,
                              java.lang.Object[] pkValues)
Convenience method for buildIdentity(java.lang.Class, java.lang.Class, java.lang.String[], java.lang.Object[])


buildIdentity

public Identity buildIdentity(java.lang.Class realClass,
                              java.lang.Object pkValue)
Convenience method for persistent objects with single primary key. NOTE: Do not use for objects with composed PK!

Parameters:
realClass - The class of the associated object.
pkValue - The PK value.
Returns:
The a new created Identity object.
See Also:
buildIdentity(java.lang.Class, java.lang.String[], java.lang.Object[])


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