net.ontopia.persistence.proxy
Class SQLOneToManyReference

java.lang.Object
  extended by net.ontopia.persistence.proxy.SQLOneToManyReference
All Implemented Interfaces:
FieldAccessIF
Direct Known Subclasses:
SQLBatchOneToManyReference

public class SQLOneToManyReference
extends java.lang.Object
implements FieldAccessIF

INTERNAL: Class that performs the task of accessing and manipulating 1:M reference fields in the database.


Field Summary
protected  RDBMSAccess access
           
protected  int batchSize
           
protected  boolean close_stm
           
protected  boolean debug
           
protected  FieldInfoIF field
           
protected  FieldInfoIF identity_field
           
protected  FieldInfoIF[] select_fields
           
protected  java.lang.String sql_add
           
protected  java.lang.String sql_clear
           
protected  java.lang.String sql_load
           
protected  java.lang.String sql_load_multiple
           
protected  java.lang.String sql_remove
           
protected  FieldInfoIF value_field
           
 
Constructor Summary
SQLOneToManyReference(RDBMSAccess access, FieldInfoIF field)
           
 
Method Summary
protected  void add_bindParameters(java.sql.PreparedStatement stm, IdentityIF identity, java.lang.Object value)
           
protected  java.sql.PreparedStatement add_getStatement()
           
protected  void add(IdentityIF identity, java.util.Collection values)
           
protected  void clear_bindParameters(java.sql.PreparedStatement stm, IdentityIF identity)
           
protected  java.sql.PreparedStatement clear_getStatement()
           
 void clear(IdentityIF identity)
          INTERNAL: Clears the field value for the given object identity.
protected  void executeUpdate(java.sql.PreparedStatement stm, java.lang.String sql)
           
 java.lang.Object load(AccessRegistrarIF registrar, IdentityIF identity)
          INTERNAL: Loads the field value for the given object identity.
 java.lang.Object loadMultiple(AccessRegistrarIF registrar, java.util.Collection identities, IdentityIF current)
          INTERNAL: Loads the field value for all the given object identities.
protected  void remove_bindParameters(java.sql.PreparedStatement stm, IdentityIF identity, java.lang.Object value)
           
protected  java.sql.PreparedStatement remove_getStatement()
           
protected  void remove(IdentityIF identity, java.util.Collection values)
           
 void storeDirty(ObjectAccessIF oaccess, java.lang.Object object)
          INTERNAL: The object field is dirty and a call to this method should cause the field value to be updated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected boolean debug

access

protected RDBMSAccess access

field

protected FieldInfoIF field

sql_load

protected java.lang.String sql_load

sql_load_multiple

protected java.lang.String sql_load_multiple

sql_add

protected java.lang.String sql_add

sql_remove

protected java.lang.String sql_remove

sql_clear

protected java.lang.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 java.lang.Object load(AccessRegistrarIF registrar,
                             IdentityIF identity)
                      throws java.lang.Exception
Description copied from interface: FieldAccessIF
INTERNAL: 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:
load in interface FieldAccessIF
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.
java.lang.Exception

loadMultiple

public java.lang.Object loadMultiple(AccessRegistrarIF registrar,
                                     java.util.Collection identities,
                                     IdentityIF current)
                              throws java.lang.Exception
Description copied from interface: FieldAccessIF
INTERNAL: 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:
loadMultiple in interface FieldAccessIF
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.
java.lang.Exception

add

protected void add(IdentityIF identity,
                   java.util.Collection values)
            throws java.lang.Exception
Throws:
java.lang.Exception

add_getStatement

protected java.sql.PreparedStatement add_getStatement()
                                               throws java.sql.SQLException
Throws:
java.sql.SQLException

add_bindParameters

protected void add_bindParameters(java.sql.PreparedStatement stm,
                                  IdentityIF identity,
                                  java.lang.Object value)
                           throws java.lang.Exception
Throws:
java.lang.Exception

remove

protected void remove(IdentityIF identity,
                      java.util.Collection values)
               throws java.lang.Exception
Throws:
java.lang.Exception

remove_getStatement

protected java.sql.PreparedStatement remove_getStatement()
                                                  throws java.sql.SQLException
Throws:
java.sql.SQLException

remove_bindParameters

protected void remove_bindParameters(java.sql.PreparedStatement stm,
                                     IdentityIF identity,
                                     java.lang.Object value)
                              throws java.lang.Exception
Throws:
java.lang.Exception

clear

public void clear(IdentityIF identity)
           throws java.lang.Exception
Description copied from interface: FieldAccessIF
INTERNAL: Clears the field value for the given object identity. This method is only applicable for 1:M and M:M fields.

Specified by:
clear in interface FieldAccessIF
Throws:
java.lang.Exception

clear_getStatement

protected java.sql.PreparedStatement clear_getStatement()
                                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

clear_bindParameters

protected void clear_bindParameters(java.sql.PreparedStatement stm,
                                    IdentityIF identity)
                             throws java.lang.Exception
Throws:
java.lang.Exception

storeDirty

public void storeDirty(ObjectAccessIF oaccess,
                       java.lang.Object object)
                throws java.lang.Exception
Description copied from interface: FieldAccessIF
INTERNAL: 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:
storeDirty in interface FieldAccessIF
Throws:
java.lang.Exception

executeUpdate

protected void executeUpdate(java.sql.PreparedStatement stm,
                             java.lang.String sql)
                      throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2000-2012 Ontopia.