public interface IdentityFactory
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
Identity
objects for transient,
"new created" persistence capable objects. But keep in mind that this transient
Identity
object is only valid till the persistence capable object was written
to datastore. After this the Identity
have to be renewed by calling
IdentityFactory.buildIdentity(...)
again (then the transient Identity
will be replaced by the persistent Identity).Modifier and Type | Method and Description |
---|---|
Identity |
buildIdentity(java.lang.Class realClass,
java.lang.Class topLevelClass,
java.lang.Object[] pkValues)
Create a new
Identity object based on given arguments - NOTE: There
will be no check to resolve the order of the PK values. |
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[] pkFieldName,
java.lang.Object[] pkValues)
Convenience shortcut 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. |
Identity buildIdentity(java.lang.Object obj)
Identity
for the given
persistence capable object.obj
- The object to build the Identity
forIdentity buildIdentity(ClassDescriptor cld, java.lang.Object obj)
Identity
for the given
persistence capable object.cld
- The ClassDescriptor
of the objectobj
- The object to build the Identity
forIdentity buildIdentity(java.lang.Class realClass, java.lang.Class topLevelClass, java.lang.String[] pkFieldName, java.lang.Object[] pkValues)
Identity
for the given primary key values (composite PK's) of a
persistence capable object.realClass
- The class of the associated objecttopLevelClass
- The top-level class of the associated objectpkFieldName
- The field names of the PK fieldspkValues
- The PK valuesIdentity buildIdentity(java.lang.Class realClass, java.lang.String[] pkFieldName, java.lang.Object[] pkValues)
buildIdentity(java.lang.Class, java.lang.Class, java.lang.String[], java.lang.Object[])
.realClass
- The class of the associated objectpkFieldName
- The field names of the PK fieldspkValues
- The PK valuesIdentity buildIdentity(java.lang.Class realClass, java.lang.Object pkValue)
realClass
- The class of the associated objectpkValue
- The PK valuebuildIdentity(java.lang.Class, java.lang.String[], java.lang.Object[])
Identity buildIdentity(java.lang.Class realClass, java.lang.Class topLevelClass, java.lang.Object[] pkValues)
Identity
object based on given arguments - NOTE: There
will be no check to resolve the order of the PK values. This method expect
the correct order based on the declaration of the FieldDescriptor
in the mapping file.realClass
- The class of the associated objecttopLevelClass
- The top-level class of the associated objectpkValues
- The PK values(C) 2002 - 2005 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