Object Translator

com.informix.ormapper
Class OCollection

java.lang.Object
  |
  +--com.informix.ormapper.OCollection

public class OCollection
extends java.lang.Object

This is the persistence superclass for all Object Translator-generated collection classes. It provides internal methods to navigate and persist collections of objects to and from databases through JDBC.

See Also:
OBase, OBaseOID

Field Summary
protected  java.util.Vector fKeyColumns
           
protected  java.lang.Object[] fKeyValues
           
protected  OResultSet resultset
           
 
Constructor Summary
OCollection()
           
 
Method Summary
 void addForeignKeyColumn(java.lang.String colName)
           
protected  void addObject(OBase baseObj)
           
protected  void addUserObject(OBase baseObj)
           
protected  void destroy()
           
 void destroyAll()
          Delete all records for this collection based on the SQL DELETE statement and its predicate.
protected  OBase findObject(OBase baseObj)
           
protected  OBase fObject()
           
 boolean getCaching()
          Checks if caching is used by this collection.
 OConnection getConnection()
           
protected  java.lang.String getDeleteSQL()
           
 java.lang.String getPredicate()
           
protected  java.lang.String getSelectSQL()
           
 java.lang.String getSortSQL()
           
protected  OBase lObject()
           
protected  OBase nObject()
           
protected  OBase pObject()
           
protected  boolean removeObject(OBase baseObj)
           
protected  void restore()
           
 void setCaching(boolean useCache)
          Turns on or off the use of caching in this collection object.
 void setConnection(OConnection _connection)
           
protected  void setDeleteSQL(java.lang.String _deleteSQL)
           
 void setForeignKeyColumns(java.util.Vector columns)
           
 void setForeignKeyValues(java.lang.Object[] values)
           
 void setPredicate(java.lang.String _predicate)
           
protected  void setSelectSQL(java.lang.String _selectSQL)
           
 void setSortSQL(java.lang.String _sortSQL)
           
 int size()
          Retrieves the sum of the current sizes of the cache for this collection & the user added Objects.
protected  void store()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resultset

protected OResultSet resultset

fKeyColumns

protected java.util.Vector fKeyColumns

fKeyValues

protected java.lang.Object[] fKeyValues
Constructor Detail

OCollection

public OCollection()
Method Detail

getSelectSQL

protected java.lang.String getSelectSQL()

setSelectSQL

protected void setSelectSQL(java.lang.String _selectSQL)

getDeleteSQL

protected java.lang.String getDeleteSQL()

setDeleteSQL

protected void setDeleteSQL(java.lang.String _deleteSQL)

getPredicate

public java.lang.String getPredicate()

setPredicate

public void setPredicate(java.lang.String _predicate)

getSortSQL

public java.lang.String getSortSQL()

setSortSQL

public void setSortSQL(java.lang.String _sortSQL)

getConnection

public OConnection getConnection()

setConnection

public void setConnection(OConnection _connection)

getCaching

public boolean getCaching()
Checks if caching is used by this collection.
Returns:
true if caching is used; false otherwise.

setCaching

public void setCaching(boolean useCache)
Turns on or off the use of caching in this collection object. You should turn caching off only if you want to use the collection in Read-Only mode, i.e. no store() or destroy(), and this method should be called before the collection is restored and used. The default is true - caching is used.
Parameters:
useCache - true turns on the caching; false turns off the caching.

setForeignKeyColumns

public void setForeignKeyColumns(java.util.Vector columns)

addForeignKeyColumn

public void addForeignKeyColumn(java.lang.String colName)

setForeignKeyValues

public void setForeignKeyValues(java.lang.Object[] values)

size

public int size()
Retrieves the sum of the current sizes of the cache for this collection & the user added Objects. The size of the cache is determined by the number of objects that have been fetched and stored in the cache, when the cache is used. The objects are fetched only after the collection has been iterated. The size of the userCollection is the number of objects added using the addObject method
Returns:
the sum of current sizes of the cache & the user added objects for this collection.

restore

protected void restore()
                throws DatabaseException,
                       NoConnectionException,
                       NoStatementException

store

protected void store()
              throws java.io.InvalidObjectException,
                     DatabaseException,
                     NoConnectionException,
                     ChangeDetectedException

destroy

protected void destroy()
                throws java.io.InvalidObjectException,
                       DatabaseException,
                       NoConnectionException,
                       ChangeDetectedException

destroyAll

public void destroyAll()
                throws DatabaseException,
                       NoConnectionException,
                       NoStatementException
Delete all records for this collection based on the SQL DELETE statement and its predicate. Unlike the destroy method, this deletes all records, including those records that have not been retrieved from the database. This method deletes records for this collection only, not including any child collection objects referenced by the main class, even if the DeepDestroy property is set to true.
Throws:
DatabaseException - if a database access error occurs.
NoConnectionException - if no connection has been set.
NoStatementException - if no delete statement has been created.

addObject

protected void addObject(OBase baseObj)

addUserObject

protected void addUserObject(OBase baseObj)

removeObject

protected boolean removeObject(OBase baseObj)

findObject

protected OBase findObject(OBase baseObj)

fObject

protected OBase fObject()

lObject

protected OBase lObject()

nObject

protected OBase nObject()

pObject

protected OBase pObject()

Object Translator

Copyright © 1999-2000 Informix Software, Inc.