Package net.ontopia.persistence.proxy
Class SQLOneToManyReference
- java.lang.Object
-
- net.ontopia.persistence.proxy.SQLOneToManyReference
-
- All Implemented Interfaces:
FieldAccessIF
- Direct Known Subclasses:
SQLBatchOneToManyReference
public class SQLOneToManyReference extends Object implements FieldAccessIF
INTERNAL: Class that performs the task of accessing and manipulating 1:M reference fields in the database.
-
-
Field Summary
Fields Modifier and Type Field Description protected RDBMSAccessaccessprotected intbatchSizeprotected booleanclose_stmprotected booleandebugprotected FieldInfoIFfieldprotected FieldInfoIFidentity_fieldprotected FieldInfoIF[]select_fieldsprotected Stringsql_addprotected Stringsql_clearprotected Stringsql_loadprotected Stringsql_load_multipleprotected Stringsql_removeprotected FieldInfoIFvalue_field
-
Constructor Summary
Constructors Constructor Description SQLOneToManyReference(RDBMSAccess access, FieldInfoIF field)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidadd(IdentityIF identity, Collection<?> values)protected voidadd_bindParameters(PreparedStatement stm, IdentityIF identity, Object value)protected PreparedStatementadd_getStatement()voidclear(IdentityIF identity)INTERNAL: Clears the field value for the given object identity.protected voidclear_bindParameters(PreparedStatement stm, IdentityIF identity)protected PreparedStatementclear_getStatement()protected voidexecuteUpdate(PreparedStatement stm, String sql)Objectload(AccessRegistrarIF registrar, IdentityIF identity)INTERNAL: Loads the field value for the given object identity.ObjectloadMultiple(AccessRegistrarIF registrar, Collection<IdentityIF> identities, IdentityIF current)INTERNAL: Loads the field value for all the given object identities.protected voidremove(IdentityIF identity, Collection<?> values)protected voidremove_bindParameters(PreparedStatement stm, IdentityIF identity, Object value)protected PreparedStatementremove_getStatement()voidstoreDirty(ObjectAccessIF oaccess, Object object)INTERNAL: The object field is dirty and a call to this method should cause the field value to be updated.
-
-
-
Field Detail
-
debug
protected boolean debug
-
access
protected RDBMSAccess access
-
field
protected FieldInfoIF field
-
sql_load
protected String sql_load
-
sql_load_multiple
protected String sql_load_multiple
-
sql_add
protected String sql_add
-
sql_remove
protected String sql_remove
-
sql_clear
protected String sql_clear
-
select_fields
protected FieldInfoIF[] select_fields
-
identity_field
protected FieldInfoIF identity_field
-
value_field
protected FieldInfoIF value_field
-
close_stm
protected boolean close_stm
-
batchSize
protected int batchSize
-
-
Constructor Detail
-
SQLOneToManyReference
public SQLOneToManyReference(RDBMSAccess access, FieldInfoIF field)
-
-
Method Detail
-
load
public Object load(AccessRegistrarIF registrar, IdentityIF identity) throws Exception
Description copied from interface:FieldAccessIFINTERNAL: Loads the field value for the given object identity. The specified access registrar will be notified about the value(s) read from the database.- Specified by:
loadin interfaceFieldAccessIF- Returns:
- The value loaded for the specific field. Note that if the field is a reference field the identity will be returned, not the actual object. This is because the storage system does not deal with persistent object instances directly.
- Throws:
IdentityNotFoundException- if the identity was not found.Exception
-
loadMultiple
public Object loadMultiple(AccessRegistrarIF registrar, Collection<IdentityIF> identities, IdentityIF current) throws Exception
Description copied from interface:FieldAccessIFINTERNAL: Loads the field value for all the given object identities. The specified access registrar will be notified about the value(s) read from the database.- Specified by:
loadMultiplein interfaceFieldAccessIF- Returns:
- The value loaded for the specific field for the current identity. Note that if the field is a reference field the identity will be returned, not the actual object. This is because the storage system does not deal with persistent object instances directly.
- Throws:
IdentityNotFoundException- if the identity was not found.Exception
-
add
protected void add(IdentityIF identity, Collection<?> values) throws Exception
- Throws:
Exception
-
add_getStatement
protected PreparedStatement add_getStatement() throws SQLException
- Throws:
SQLException
-
add_bindParameters
protected void add_bindParameters(PreparedStatement stm, IdentityIF identity, Object value) throws Exception
- Throws:
Exception
-
remove
protected void remove(IdentityIF identity, Collection<?> values) throws Exception
- Throws:
Exception
-
remove_getStatement
protected PreparedStatement remove_getStatement() throws SQLException
- Throws:
SQLException
-
remove_bindParameters
protected void remove_bindParameters(PreparedStatement stm, IdentityIF identity, Object value) throws Exception
- Throws:
Exception
-
clear
public void clear(IdentityIF identity) throws Exception
Description copied from interface:FieldAccessIFINTERNAL: Clears the field value for the given object identity. This method is only applicable for 1:M and M:M fields.- Specified by:
clearin interfaceFieldAccessIF- Throws:
Exception
-
clear_getStatement
protected PreparedStatement clear_getStatement() throws SQLException
- Throws:
SQLException
-
clear_bindParameters
protected void clear_bindParameters(PreparedStatement stm, IdentityIF identity) throws Exception
- Throws:
Exception
-
storeDirty
public void storeDirty(ObjectAccessIF oaccess, Object object) throws Exception
Description copied from interface:FieldAccessIFINTERNAL: The object field is dirty and a call to this method should cause the field value to be updated. Note that the field access may also store other field values if it decides to do so. After the field value(s) has been updated the dirty flag(s) should be set to false.- Specified by:
storeDirtyin interfaceFieldAccessIF- Throws:
Exception
-
executeUpdate
protected void executeUpdate(PreparedStatement stm, String sql) throws Exception
- Throws:
Exception
-
-