|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hydrateframework.ObjectFactory
public class ObjectFactory
createObject(org.hydrateframework.ObjectContext, org.hydrateframework.ObjectKey)
method can be used to create an object of the designated class.
loadObject(org.hydrateframework.ObjectContext, org.hydrateframework.ObjectKey, int)
method reads a single object from the
the database using the default query, and the saveObject(org.hydrateframework.SaveContext, java.lang.Object, java.lang.Class)
method writes a
changed object back.Constructor Summary | |
---|---|
ObjectFactory(ObjectContext ctx,
java.lang.Class ifcClass,
java.lang.Class implClass,
java.lang.Class assemblerClass,
java.lang.Class queryToUse,
java.lang.String dsName,
java.lang.Class proxyClass)
Construct a factory for creating Hydrate Objects. |
Method Summary | |
---|---|
java.lang.Object |
createObject(ObjectContext ctx,
ObjectKey key)
Create an object with a key. |
void |
deleteObject(SaveContext sc,
java.lang.Object obj,
java.lang.Class keyClass)
Remove an object from the database. |
Assembler |
getAssembler()
|
java.lang.String |
getDsName()
Return the name of the datasource that this factory uses when reading or writing objects from the default database. |
NamedParameterStatement |
getStatement(RequestContext rc)
|
java.lang.Object |
loadObject(ObjectContext ctx,
ObjectKey key,
int bldType)
Load an object using a key. |
HydrateObject |
proxyObject(ObjectContext ctx,
java.lang.Object o)
Provides a temporary proxy for a non-Hydrate object. |
void |
readKeyBatch(SaveContext sc,
NamedParameterStatement stmt,
java.util.List objs)
Called to get database generated keys for objects that were updated in a batch. |
java.lang.Object |
reloadObject(ObjectContext ctx,
java.lang.Object obj)
Reload an existing object. |
void |
saveObject(SaveContext sc,
java.lang.Object obj,
java.lang.Class keyClass)
Update the database with changes made to a business object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectFactory(ObjectContext ctx, java.lang.Class ifcClass, java.lang.Class implClass, java.lang.Class assemblerClass, java.lang.Class queryToUse, java.lang.String dsName, java.lang.Class proxyClass)
ctx
- the object context into which this factory will be objects by default.implClass
- the concrete class of object that this factory will buildassemblerClass
- the class of assembler used to build objects - must be compatible with implClassqueryToUse
- the query to use to read and write objects to the databasedsName
- the name of the datasource to which objects will be read and writtenMethod Detail |
---|
public java.lang.String getDsName()
public HydrateObject proxyObject(ObjectContext ctx, java.lang.Object o)
ctx
- the object context in which the proxy object will reside.o
- The object for which a proxy is required.
public java.lang.Object createObject(ObjectContext ctx, ObjectKey key)
public NamedParameterStatement getStatement(RequestContext rc) throws SaveException
SaveException
public Assembler getAssembler()
public java.lang.Object reloadObject(ObjectContext ctx, java.lang.Object obj) throws SaveException
obj
- The object to be reloaded from the database
SaveException
public java.lang.Object loadObject(ObjectContext ctx, ObjectKey key, int bldType) throws SaveException
ObjectKey.constrainQuery(org.hydrateframework.sql.NamedParameterStatement, java.lang.String)
callback on the key object to restrict the query to a single row.
ctx
- the business object context to load the object into.key
- the key to use to load the object.bldType
- one of the Assembler.BUILD_- values.
SaveException
public void saveObject(SaveContext sc, java.lang.Object obj, java.lang.Class keyClass) throws SaveException
getKey().isPersisted()
false), the object will be inserted into the database. As part of this process
a new key will be generated and assigned and the object will be re-indexed
as a result.
obj
- the business object that is to be updated or inserted
SaveException
public void readKeyBatch(SaveContext sc, NamedParameterStatement stmt, java.util.List objs) throws SaveException
sc
- the save contextstmt
- the batched statement that will generate keys.objs
- a list of objects that need keys - there should be the same number
of objects in the list as update statements in the batch, in the same order.
SaveException
public void deleteObject(SaveContext sc, java.lang.Object obj, java.lang.Class keyClass) throws SaveException
getStatement(org.hydrateframework.RequestContext)
to remove the data for this object from the database. This
is purely a database operation. It will not remove the object from memory
although the memory version will have its key set to null. It will not remove
any references to this object by other objects though if any exist, the delete
operation will probably fail due to violated reference integrity constraints.
obj
- the object to be removed from the database.
SaveException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |