com.triactive.jdo.store.mapping
Class SetMapping

java.lang.Object
  extended bycom.triactive.jdo.store.mapping.Mapping
      extended bycom.triactive.jdo.store.mapping.ComplexMapping
          extended bycom.triactive.jdo.store.mapping.SetMapping

public class SetMapping
extends ComplexMapping


Field Summary
 
Fields inherited from class com.triactive.jdo.store.mapping.Mapping
dba, fmd, type
 
Constructor Summary
SetMapping(DatabaseAdapter dba, java.lang.Class type)
           
SetMapping(DatabaseAdapter dba, FieldMetaData fmd)
           
 
Method Summary
 SqlExpression accessAsFieldIn(FcoExpression objExpr)
          Returns an SQL expression representing the persistent field mapped by this mapping within a particular first-class object expression.
 void defineConstraints(BaseTable table, StoreManager.MgmtTransaction mtx)
          Causes the mapping object to define whatever constraints it needs on its backing storage, relative to the specified table.
 void defineStorage(Table table, StoreManager.MgmtTransaction mtx)
          Causes the mapping object to define whatever backing storage it needs, relative to the specified table.
 void deleteObject(StateManager sm)
          Deletes an object from the database.
 void deleteObjects(java.util.Collection sms)
          Deletes a collection of objects from the database.
 boolean equals(java.lang.Object obj)
          Tests this object for equality with another object.
 java.lang.Object fetchObject(StateManager sm)
          Fetchs an object from the database.
 PersistentSet getBackingSet(StateManager sm)
           
 int hashCode()
          Returns a hash code value for this object.
 void insertObject(StateManager sm, java.lang.Object value)
          Inserts an object in the database.
 SqlExpression newSqlLiteral(QueryStatement qs, java.lang.Object value)
          Returns an SQL expression representing the literal value of a Java object.
 void updateObject(StateManager sm, java.lang.Object value)
          Updates an object in the database.
 
Methods inherited from class com.triactive.jdo.store.mapping.Mapping
getDefaultMappingsByType, getFieldMetaData, getType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SetMapping

public SetMapping(DatabaseAdapter dba,
                  java.lang.Class type)

SetMapping

public SetMapping(DatabaseAdapter dba,
                  FieldMetaData fmd)
Method Detail

defineStorage

public void defineStorage(Table table,
                          StoreManager.MgmtTransaction mtx)
Description copied from class: Mapping
Causes the mapping object to define whatever backing storage it needs, relative to the specified table. Depending on the type of mapping, this may mean adding columns to the table, constructing other related table objects, or both.

Storage in this case means only tables, columns, and primary keys. Other candidate keys, foreign keys, and indexes are added by Mapping.defineConstraints(com.triactive.jdo.store.sql.BaseTable, com.triactive.jdo.store.StoreManager.MgmtTransaction).

The StoreManager will never call this method more than once.

Specified by:
defineStorage in class Mapping
Parameters:
table - the table relative to which storage should be defined.
mtx - the context in which the mapping is being initialized

defineConstraints

public void defineConstraints(BaseTable table,
                              StoreManager.MgmtTransaction mtx)
Description copied from class: Mapping
Causes the mapping object to define whatever constraints it needs on its backing storage, relative to the specified table. Depending on the type of mapping, this may mean adding any or all of candidate keys, foreign keys, or indexes to the specified table and/or other tables.

This method only applies to base tables. It will always be called after calling Mapping.defineStorage(com.triactive.jdo.store.sql.Table, com.triactive.jdo.store.StoreManager.MgmtTransaction) and is passed the same table argument.

The StoreManager will never call this method more than once.

Specified by:
defineConstraints in class Mapping
Parameters:
table - the table relative to which constraints should be defined.
mtx - the context in which the mapping is being initialized

getBackingSet

public PersistentSet getBackingSet(StateManager sm)

insertObject

public void insertObject(StateManager sm,
                         java.lang.Object value)
Description copied from class: ComplexMapping
Inserts an object in the database.

Specified by:
insertObject in class ComplexMapping
Parameters:
sm - The state manager of the instance owning the Java object being inserted.
value - The object to insert.

fetchObject

public java.lang.Object fetchObject(StateManager sm)
Description copied from class: ComplexMapping
Fetchs an object from the database.

Specified by:
fetchObject in class ComplexMapping
Parameters:
sm - The state manager of the instance owning the Java object being fetched.

updateObject

public void updateObject(StateManager sm,
                         java.lang.Object value)
Description copied from class: ComplexMapping
Updates an object in the database.

Specified by:
updateObject in class ComplexMapping
Parameters:
sm - The state manager of the instance owning the Java object being updated.
value - The object to update.

deleteObject

public void deleteObject(StateManager sm)
Description copied from class: ComplexMapping
Deletes an object from the database.

Specified by:
deleteObject in class ComplexMapping
Parameters:
sm - The state manager of the instance owning the Java object being deleted.

deleteObjects

public void deleteObjects(java.util.Collection sms)
Description copied from class: ComplexMapping
Deletes a collection of objects from the database. The specified collection cannot be empty.

Specified by:
deleteObjects in class ComplexMapping
Parameters:
sms - The state managers of the instances owning the Java objects being deleted. Must be non-empty.

newSqlLiteral

public SqlExpression newSqlLiteral(QueryStatement qs,
                                   java.lang.Object value)
Description copied from class: Mapping
Returns an SQL expression representing the literal value of a Java object. The object must be of a type used with this mapping.

Specified by:
newSqlLiteral in class Mapping
Parameters:
qs - the surrounding query statement for the expression
value - the literal value

accessAsFieldIn

public SqlExpression accessAsFieldIn(FcoExpression objExpr)
Description copied from class: Mapping
Returns an SQL expression representing the persistent field mapped by this mapping within a particular first-class object expression. Throws an exception if this mapping does not map a specified persistent field.

Specified by:
accessAsFieldIn in class Mapping
Parameters:
objExpr - an expression representing a first-class object

hashCode

public int hashCode()
Description copied from class: Mapping
Returns a hash code value for this object.

Overrides:
hashCode in class Mapping

equals

public boolean equals(java.lang.Object obj)
Description copied from class: Mapping
Tests this object for equality with another object. Two Mapping objects are equal if they are of the same type and their database adapters, types, and field metadata (if present) are all equal.

Overrides:
equals in class Mapping
Parameters:
obj - the object to compare with
Returns:
true if the objects are equal, false otherwise.


Copyright 2001-2007 The TJDO Project All Rights Reserved.