org.jpox.store.rdbms.scostore
Class JoinListStore

java.lang.Object
  extended by org.jpox.store.rdbms.scostore.ElementContainerStore
      extended by org.jpox.store.rdbms.scostore.AbstractCollectionStore
          extended by org.jpox.store.rdbms.scostore.JoinListStore
All Implemented Interfaces:
org.jpox.store.mapped.scostore.CollectionStoreQueryable, org.jpox.store.scostore.CollectionStore, org.jpox.store.scostore.ListStore, org.jpox.store.scostore.Store

public class JoinListStore
extends AbstractCollectionStore

Representation of the backing store for a join-table List. Uses a Join table, so we use 3 tables - owner table, join table and element table.

Version:
$Revision: 1.51 $

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jpox.store.rdbms.scostore.ElementContainerStore
ElementContainerStore.ElementInfo
 
Field Summary
protected  boolean allowsNull
          Whether the container allows null elements/values.
protected  org.jpox.store.mapped.DatastoreAdapter dba
          Datastore adapter in use by this store.
protected  boolean indexedList
          Whether the list is indexed (like with JDO).
protected  java.lang.String indexOfStmt
           
protected  java.lang.String lastIndexOfStmt
           
protected  java.lang.String listName
           
protected static org.jpox.util.Localiser LOCALISER
          Localiser for messages.
protected  org.jpox.store.mapped.mapping.JavaTypeMapping ownerMapping
          Mapping to the owner of the container.
protected  org.jpox.metadata.AbstractMemberMetaData ownerMemberMetaData
          MetaData for the field/property in the owner with this container.
protected  java.lang.String removeAtStmt
           
protected  java.lang.String setStmt
           
protected  java.lang.String shiftStmt
           
protected  RDBMSManager storeMgr
          Manager for the store.
 
Fields inherited from class org.jpox.store.rdbms.scostore.AbstractCollectionStore
containsStmt
 
Fields inherited from class org.jpox.store.rdbms.scostore.ElementContainerStore
addStmt, clearStmt, clr, containerTable, elementInfo, elementIsPersistentInterface, elementMapping, elementsAreEmbedded, elementsAreSerialised, elementType, elmIdentifier, emd, iterateUsingDiscriminator, orderMapping, relationDiscriminatorMapping, relationDiscriminatorValue, removeStmt, usingDiscriminatorInSizeStmt
 
Constructor Summary
JoinListStore(org.jpox.metadata.AbstractMemberMetaData fmd, CollectionTable joinTable, org.jpox.ClassLoaderResolver clr)
          Constructor.
 
Method Summary
 boolean add(org.jpox.StateManager sm, java.lang.Object element, int size)
          Method to add an element to the List.
 void add(org.jpox.StateManager sm, java.lang.Object element, int index, int size)
          Method to add an element to the List.
 boolean addAll(org.jpox.StateManager sm, java.util.Collection elements, int size)
          Method to add a collection of elements to the List.
 boolean addAll(org.jpox.StateManager sm, java.util.Collection elements, int index, int size)
          Method to add all elements from a Collection to the List.
protected  boolean allowsBatching()
          Convenience method to return if the RDBMS supports batching and the user wants batching.
 java.lang.Object get(org.jpox.StateManager sm, int index)
          Method to retrieve an element from the List.
protected  java.lang.String getIndexOfStmt()
          Generate statement for getting the index of an item.
protected  int[] getIndicesOf(org.jpox.StateManager sm, java.util.Collection elements)
          Utility to find the indices of a collection of elements.
protected  java.lang.String getIndicesOfStmt(java.util.Collection elements)
          Generates the statement for getting the indices of a collection of element.
protected  org.jpox.store.mapped.expression.QueryExpression getIteratorStatement(org.jpox.StateManager ownerSM, int start_index, int end_index)
          Accessor for the iterator statement to retrieve element(s) in a range from the List.
protected  java.lang.String getLastIndexOfStmt()
          Generates the statement for getting the index of the last item.
 org.jpox.store.mapped.mapping.JavaTypeMapping getOwnerMapping()
          Accessor for the owner mapping.
protected  java.lang.String getRemoveAllStmt(java.util.Collection elements)
          Generate statement for removing a collection of items from the List.
protected  java.lang.String getRemoveAtStmt()
          Generates the statement for removing an item.
protected  java.lang.String getSetStmt()
          Generates the statement for setting an item.
protected  java.lang.String getShiftStmt()
          Generates the statement for shifting items.
protected  org.jpox.StateManager getStateManagerForEmbeddedPCObject(org.jpox.StateManager sm, java.lang.Object obj, JoinTable table)
          Method to return the StateManager for an embedded PC object (element, key, value).
 org.jpox.store.StoreManager getStoreManager()
          Accessor for the RDBMSManager.
 int indexOf(org.jpox.StateManager sm, java.lang.Object element)
          Accessor for the indexOf an object in the List.
protected  boolean internalAdd(org.jpox.StateManager sm, int start, boolean atEnd, java.util.Collection c, int size)
          Internal method to add element(s) to the List.
protected  java.util.List internalGetRange(org.jpox.StateManager sm, int start, int end)
          Utility to retrieve (as a List) the elements for the List in a range depending on the specified start/end positions.
protected  boolean internalRemove(org.jpox.StateManager ownerSM, java.lang.Object element, int size)
          Convenience method to remove the specified element from the List.
protected  void internalRemoveAt(org.jpox.StateManager sm, int index, java.lang.String stmt, int size)
          Internal method to remove an object at a location in the List.
protected  int[] internalShift(org.jpox.StateManager ownerSM, org.jpox.ManagedConnection conn, boolean batched, int oldIndex, int amount, boolean executeNow)
          Method to process a "shift" statement, updating the index in the list of the specified index.
protected  boolean isEmbeddedMapping(org.jpox.store.mapped.mapping.JavaTypeMapping mapping)
          Check if the mapping correspond to a non pc object or embedded field
 java.util.Iterator iterator(org.jpox.StateManager sm)
          Accessor for an iterator through the list elements.
 org.jpox.store.mapped.expression.ScalarExpression joinElementsTo(org.jpox.store.mapped.expression.QueryExpression stmt, org.jpox.store.mapped.expression.QueryExpression parentStmt, org.jpox.store.mapped.mapping.JavaTypeMapping ownerMapping, org.jpox.store.mapped.expression.LogicSetExpression ownerTblExpr, org.jpox.store.mapped.DatastoreIdentifier listTableAlias, java.lang.Class filteredElementType, org.jpox.store.mapped.expression.ScalarExpression elementExpr, org.jpox.store.mapped.DatastoreIdentifier elementTableAlias, boolean existsQuery)
          Method used in queries when contains() has been invoked to join the collection table to the element table.
 int lastIndexOf(org.jpox.StateManager sm, java.lang.Object element)
          Method to retrieve the last index of an object in the list.
 java.util.ListIterator listIterator(org.jpox.StateManager sm)
          Accessor for an iterator through the list elements.
 java.util.ListIterator listIterator(org.jpox.StateManager ownerSM, int start)
          Accessor for an iterator through the list elements.
 org.jpox.store.mapped.expression.QueryExpression newQueryStatement(org.jpox.StateManager sm, java.lang.String candidateClass, org.jpox.store.mapped.DatastoreIdentifier candidateAlias)
          Utility to return a new QueryStatement.
protected  int populateOwnerInStatement(org.jpox.StateManager sm, org.jpox.ObjectManager om, java.sql.PreparedStatement ps, int jdbcPosition)
          Convenience method to populate the passed PreparedStatement with the value from the owner.
protected  void prepareIndicesOfStmt(org.jpox.StateManager sm, java.sql.PreparedStatement ps, java.util.Collection elements)
          Method to prepare the indicesOf statement for use.
 java.lang.Object remove(org.jpox.StateManager sm, int index, int size)
          Method to remove an object at an index in the List.
 boolean remove(org.jpox.StateManager sm, java.lang.Object element, int size, boolean allowDependentField)
          Method to remove the specified element from the List.
 boolean removeAll(org.jpox.StateManager sm, java.util.Collection elements, int size)
          Remove all elements from a collection from the association owner vs elements.
protected  void removeAt(org.jpox.StateManager sm, int index, int size)
          Method to remove an element from the specified position
 java.lang.Object set(org.jpox.StateManager sm, int index, java.lang.Object element, boolean allowDependentField)
          Method to set an object in the List.
protected  void setOwnerMemberMetaData(org.jpox.metadata.AbstractMemberMetaData mmd)
          Method to set the owner field/property MetaData and sets whether null elements/values are allowed.
 java.util.List subList(org.jpox.StateManager sm, int start, int end)
          Method to retrieve a list of elements in a range.
 
Methods inherited from class org.jpox.store.rdbms.scostore.AbstractCollectionStore
contains, getContainsStmt, getExistsSubquery, getRemoveStmt, getSizeSubquery, getUpdateEmbeddedElementStmt, internalRemove, updateEmbeddedElement
 
Methods inherited from class org.jpox.store.rdbms.scostore.ElementContainerStore
clear, getAddStmt, getClearStmt, getElementInformationForClass, getElementType, getSizeStmt, hasOrderMapping, newResultObjectFactory, populateElementDiscriminatorInStatement, populateElementInStatement, populateEmbeddedElementFieldsInStatement, populateOrderInStatement, populateRelationDiscriminatorInStatement, size, validateElementForReading, validateElementForWriting, validateElementType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jpox.store.scostore.CollectionStore
clear, contains, getElementType, hasOrderMapping, size, updateEmbeddedElement
 
Methods inherited from interface org.jpox.store.scostore.Store
getStoreManager
 
Methods inherited from interface org.jpox.store.mapped.scostore.CollectionStoreQueryable
newResultObjectFactory
 

Field Detail

listName

protected java.lang.String listName

removeAtStmt

protected java.lang.String removeAtStmt

setStmt

protected java.lang.String setStmt

shiftStmt

protected java.lang.String shiftStmt

indexOfStmt

protected java.lang.String indexOfStmt

lastIndexOfStmt

protected java.lang.String lastIndexOfStmt

indexedList

protected boolean indexedList
Whether the list is indexed (like with JDO). If false then it will have no orderMapping (like with JPA).


LOCALISER

protected static final org.jpox.util.Localiser LOCALISER
Localiser for messages.


storeMgr

protected RDBMSManager storeMgr
Manager for the store.


dba

protected org.jpox.store.mapped.DatastoreAdapter dba
Datastore adapter in use by this store.


ownerMapping

protected org.jpox.store.mapped.mapping.JavaTypeMapping ownerMapping
Mapping to the owner of the container.


ownerMemberMetaData

protected org.jpox.metadata.AbstractMemberMetaData ownerMemberMetaData
MetaData for the field/property in the owner with this container.


allowsNull

protected boolean allowsNull
Whether the container allows null elements/values.

Constructor Detail

JoinListStore

public JoinListStore(org.jpox.metadata.AbstractMemberMetaData fmd,
                     CollectionTable joinTable,
                     org.jpox.ClassLoaderResolver clr)
Constructor.

Parameters:
joinTable - The join table
clr - ClassLoader resolver
Method Detail

internalAdd

protected boolean internalAdd(org.jpox.StateManager sm,
                              int start,
                              boolean atEnd,
                              java.util.Collection c,
                              int size)
Internal method to add element(s) to the List. Performs the add in 2 steps.
  1. Shift all existing elements into their new positions so we can insert.
  2. Insert all new elements directly at their desired positions>/li>
Both steps can be batched (separately).

Parameters:
sm - The state manager
start - The start location (if required)
atEnd - Whether to add the element at the end
c - The collection of objects to add.
size - Current size of list if known. -1 if not known
Returns:
Whether it was successful

set

public java.lang.Object set(org.jpox.StateManager sm,
                            int index,
                            java.lang.Object element,
                            boolean allowDependentField)
Method to set an object in the List.

Parameters:
sm - The state manager
index - The item index
element - What to set it to.
allowDependentField - Whether to allow dependent field deletes
Returns:
The value before setting.

getSetStmt

protected java.lang.String getSetStmt()
Generates the statement for setting an item.
 UPDATE LISTTABLE SET [ELEMENTCOL = ?]
 [EMBEDDEDFIELD1=?, EMBEDDEDFIELD2=?, ...]
 WHERE OWNERCOL = ? 
 AND INDEXCOL = ?
 [AND DISTINGUISHER=?]
 

Returns:
The Statement for setting an item

internalRemove

protected boolean internalRemove(org.jpox.StateManager ownerSM,
                                 java.lang.Object element,
                                 int size)
Convenience method to remove the specified element from the List.

Parameters:
element - The element
ownerSM - StateManager of the owner
size - Current size of list if known. -1 if not known
Returns:
Whether the List was modified

removeAll

public boolean removeAll(org.jpox.StateManager sm,
                         java.util.Collection elements,
                         int size)
Remove all elements from a collection from the association owner vs elements. Performs the removal in 3 steps. The first gets the indices that will be removed (and the highest index present). The second step removes these elements from the list. The third step updates the indices of the remaining indices to fill the holes created.

Specified by:
removeAll in interface org.jpox.store.scostore.CollectionStore
Parameters:
sm - State Manager for the container
elements - Collection of elements to remove
Returns:
Whether the database was updated

removeAt

protected void removeAt(org.jpox.StateManager sm,
                        int index,
                        int size)
Method to remove an element from the specified position

Parameters:
sm - The State Manager for the list
index - The index of the element
size - Current size of list (if known). -1 if not known

getRemoveAllStmt

protected java.lang.String getRemoveAllStmt(java.util.Collection elements)
Generate statement for removing a collection of items from the List.
 DELETE FROM LISTTABLE 
 WHERE (OWNERCOL=? AND ELEMENTCOL=?) OR
      (OWNERCOL=? AND ELEMENTCOL=?) OR
      (OWNERCOL=? AND ELEMENTCOL=?)
 

Parameters:
elements - Collection of elements to remove
Returns:
Statement for deleting items from the List.

getIteratorStatement

protected org.jpox.store.mapped.expression.QueryExpression getIteratorStatement(org.jpox.StateManager ownerSM,
                                                                                int start_index,
                                                                                int end_index)
Accessor for the iterator statement to retrieve element(s) in a range from the List. This has 5 modes

Parameters:
ownerSM - The StateManager
start_index - The start position in the List.
end_index - The end position in the List.
Returns:
The QueryStatement.

newQueryStatement

public org.jpox.store.mapped.expression.QueryExpression newQueryStatement(org.jpox.StateManager sm,
                                                                          java.lang.String candidateClass,
                                                                          org.jpox.store.mapped.DatastoreIdentifier candidateAlias)
Utility to return a new QueryStatement.

Parameters:
sm - The state manager
candidateClass - The base class
candidateAlias - Alias for the candidate
Returns:
The QueryStatement

joinElementsTo

public org.jpox.store.mapped.expression.ScalarExpression joinElementsTo(org.jpox.store.mapped.expression.QueryExpression stmt,
                                                                        org.jpox.store.mapped.expression.QueryExpression parentStmt,
                                                                        org.jpox.store.mapped.mapping.JavaTypeMapping ownerMapping,
                                                                        org.jpox.store.mapped.expression.LogicSetExpression ownerTblExpr,
                                                                        org.jpox.store.mapped.DatastoreIdentifier listTableAlias,
                                                                        java.lang.Class filteredElementType,
                                                                        org.jpox.store.mapped.expression.ScalarExpression elementExpr,
                                                                        org.jpox.store.mapped.DatastoreIdentifier elementTableAlias,
                                                                        boolean existsQuery)
Method used in queries when contains() has been invoked to join the collection table to the element table.

Parameters:
stmt - The Query Statement
parentStmt - the parent Query Statement. If no parent, "parentStmt" must be equal to "stmt"
ownerMapping - the mapping for the owner
ownerTblExpr - Table Expression for the owner
filteredElementType - The Class Type for the filtered element
elementExpr - Expression for the element
elementTableAlias - The SQL alias to assign to the element table expression
listTableAlias - The alias for the "List" table.
existsQuery - Whether this is joining for an EXISTS query
Returns:
expression for the join

iterator

public java.util.Iterator iterator(org.jpox.StateManager sm)
Accessor for an iterator through the list elements.

Specified by:
iterator in interface org.jpox.store.scostore.CollectionStore
Specified by:
iterator in class ElementContainerStore
Parameters:
sm - State Manager for the container.
Returns:
The Iterator

listIterator

public java.util.ListIterator listIterator(org.jpox.StateManager sm)
Accessor for an iterator through the list elements.

Specified by:
listIterator in interface org.jpox.store.scostore.ListStore
Parameters:
sm - State Manager for the container.
Returns:
The List Iterator

listIterator

public java.util.ListIterator listIterator(org.jpox.StateManager ownerSM,
                                           int start)
Accessor for an iterator through the list elements.

Specified by:
listIterator in interface org.jpox.store.scostore.ListStore
Parameters:
ownerSM - State Manager for the container.
start - The start point in the list.
Returns:
The List Iterator

add

public boolean add(org.jpox.StateManager sm,
                   java.lang.Object element,
                   int size)
Method to add an element to the List.

Specified by:
add in interface org.jpox.store.scostore.CollectionStore
Parameters:
sm - The state manager
element - The element to remove
size - Size of the current list (if known, -1 if not)
Returns:
Whether it was added successfully.

add

public void add(org.jpox.StateManager sm,
                java.lang.Object element,
                int index,
                int size)
Method to add an element to the List.

Specified by:
add in interface org.jpox.store.scostore.ListStore
Parameters:
element - The element to add.
index - The location to add at
sm - The state manager.

addAll

public boolean addAll(org.jpox.StateManager sm,
                      java.util.Collection elements,
                      int size)
Method to add a collection of elements to the List.

Specified by:
addAll in interface org.jpox.store.scostore.CollectionStore
Parameters:
sm - The state manager
elements - The elements to remove
size - Current size of the list (if known). -1 if not known
Returns:
Whether they were added successfully.

addAll

public boolean addAll(org.jpox.StateManager sm,
                      java.util.Collection elements,
                      int index,
                      int size)
Method to add all elements from a Collection to the List.

Specified by:
addAll in interface org.jpox.store.scostore.ListStore
Parameters:
sm - The state manager
elements - The collection
index - The location to add at
size - Current size of the list (if known). -1 if not known
Returns:
Whether it was successful

get

public java.lang.Object get(org.jpox.StateManager sm,
                            int index)
Method to retrieve an element from the List.

Specified by:
get in interface org.jpox.store.scostore.ListStore
Parameters:
sm - The state manager
index - The location of the element.
Returns:
The object

indexOf

public int indexOf(org.jpox.StateManager sm,
                   java.lang.Object element)
Accessor for the indexOf an object in the List.

Specified by:
indexOf in interface org.jpox.store.scostore.ListStore
Parameters:
sm - The state manager
element - The element.
Returns:
The index

lastIndexOf

public int lastIndexOf(org.jpox.StateManager sm,
                       java.lang.Object element)
Method to retrieve the last index of an object in the list.

Specified by:
lastIndexOf in interface org.jpox.store.scostore.ListStore
Parameters:
sm - The state manager.
element - The object
Returns:
The last index

remove

public boolean remove(org.jpox.StateManager sm,
                      java.lang.Object element,
                      int size,
                      boolean allowDependentField)
Method to remove the specified element from the List.

Specified by:
remove in interface org.jpox.store.scostore.CollectionStore
Parameters:
sm - The state manager
element - The element to remove.
size - Current size of list if known. -1 if not known
allowDependentField - Whether to allow any cascade deletes caused by this removal
Returns:
Whether it was removed successfully.

remove

public java.lang.Object remove(org.jpox.StateManager sm,
                               int index,
                               int size)
Method to remove an object at an index in the List.

Specified by:
remove in interface org.jpox.store.scostore.ListStore
Parameters:
index - The location
sm - The state manager
size - Current size of the list (if known). -1 if not known
Returns:
The object that was removed

subList

public java.util.List subList(org.jpox.StateManager sm,
                              int start,
                              int end)
Method to retrieve a list of elements in a range.

Specified by:
subList in interface org.jpox.store.scostore.ListStore
Parameters:
sm - The state manager.
start - From index (inclusive)
end - To index (exclusive)
Returns:
Sub List of elements in this range.

getIndexOfStmt

protected java.lang.String getIndexOfStmt()
Generate statement for getting the index of an item.
 SELECT INDEXCOL FROM LISTTABLE
 WHERE OWNERCOL=? 
 AND ELEMENTCOL=? 
 [AND EMBEDDEDFIELD1=? AND EMBEDDEDFIELD2=? AND ...]
 [AND DISTINGUISHER=?]
 ORDER BY INDEXCOL
 

Returns:
The Statement for getting the index of an item

getLastIndexOfStmt

protected java.lang.String getLastIndexOfStmt()
Generates the statement for getting the index of the last item.
 
 SELECT INDEXCOL FROM LISTTABLE 
 WHERE OWNERCOL=? 
 AND ELEMENTCOL=?
 [AND EMBEDDEDFIELD1=? AND EMBEDDEDFIELD2=? AND ...]
 [AND DISTINGUISHER=?]
 ORDER BY INDEXCOL DESC
 

Returns:
The Statement for getting the last item

getRemoveAtStmt

protected java.lang.String getRemoveAtStmt()
Generates the statement for removing an item.
 
 DELETE FROM LISTTABLE
 WHERE OWNERCOL = ? 
 AND INDEXCOL = ?
 [AND DISTINGUISHER=?]
 

Returns:
The Statement for removing an item from a position

getShiftStmt

protected java.lang.String getShiftStmt()
Generates the statement for shifting items.
 
 UPDATE LISTTABLE SET INDEXCOL = ?
 WHERE OWNERCOL = ?
 AND INDEXCOL = ?
 [AND DISTINGUISHER=?]
 

Returns:
The Statement for shifting elements

getIndicesOfStmt

protected java.lang.String getIndicesOfStmt(java.util.Collection elements)
Generates the statement for getting the indices of a collection of element. Order into descending index order (highest first) so they will NOT be in the same order as they appear in the input collection "elements".
 SELECT INDEXCOL FROM LISTTABLE 
 WHERE (OWNERCOL=? AND ELEMENT_COL=? [AND DISTINGUISHER=?]) OR
       (OWNERCOL=? AND ELEMENT_COL=? [AND DISTINGUISHER=?]) OR
       (OWNERCOL=? AND ELEMENT_COL=? [AND DISTINGUISHER=?]) 
 ORDER BY INDEXCOL DESC
 

Parameters:
elements - The elements to retrieve the indices for.
Returns:
The Statement for getting the indices of the collection.

prepareIndicesOfStmt

protected void prepareIndicesOfStmt(org.jpox.StateManager sm,
                                    java.sql.PreparedStatement ps,
                                    java.util.Collection elements)
Method to prepare the indicesOf statement for use. Populates the various parameters. This is required because the query is built dynamically depending on the number of elements to retrieve the indices for.

Parameters:
sm - State Manager of the container.
ps - The Prepared Statement
elements - Collection of elements

internalRemoveAt

protected void internalRemoveAt(org.jpox.StateManager sm,
                                int index,
                                java.lang.String stmt,
                                int size)
Internal method to remove an object at a location in the List.

Parameters:
sm - The state manager.
index - The location
stmt - The statement to remove the element from the List
size - Current list size (if known). -1 if not known

internalShift

protected int[] internalShift(org.jpox.StateManager ownerSM,
                              org.jpox.ManagedConnection conn,
                              boolean batched,
                              int oldIndex,
                              int amount,
                              boolean executeNow)
                       throws java.sql.SQLException
Method to process a "shift" statement, updating the index in the list of the specified index.

Parameters:
ownerSM - StateManager of the owner
conn - The connection
batched - Whether the statement is batched
oldIndex - The old index
amount - Amount to shift by (negative means shift down)
executeNow - Whether to execute the statement now (or wait for batching)
Returns:
Return code(s) from any executed statements
Throws:
java.sql.SQLException - Thrown if an error occurs

getIndicesOf

protected int[] getIndicesOf(org.jpox.StateManager sm,
                             java.util.Collection elements)
Utility to find the indices of a collection of elements. The returned list are in reverse order (highest index first).

Parameters:
sm - The state manager.
elements - The elements
Returns:
The indices of the elements in the List.

internalGetRange

protected java.util.List internalGetRange(org.jpox.StateManager sm,
                                          int start,
                                          int end)
Utility to retrieve (as a List) the elements for the List in a range depending on the specified start/end positions.

Parameters:
sm - State Manager for the container
start - Start position in the List.
end - End position in the List.
Returns:
The List of elements matching the range specification.

setOwnerMemberMetaData

protected void setOwnerMemberMetaData(org.jpox.metadata.AbstractMemberMetaData mmd)
Method to set the owner field/property MetaData and sets whether null elements/values are allowed.

Parameters:
mmd - MetaData for the field/property owning this backing store.

getStoreManager

public org.jpox.store.StoreManager getStoreManager()
Accessor for the RDBMSManager.

Returns:
The RDBMSManager.

getOwnerMapping

public org.jpox.store.mapped.mapping.JavaTypeMapping getOwnerMapping()
Accessor for the owner mapping.

Returns:
Owner mapping.

isEmbeddedMapping

protected boolean isEmbeddedMapping(org.jpox.store.mapped.mapping.JavaTypeMapping mapping)
Check if the mapping correspond to a non pc object or embedded field

Parameters:
mapping - the mapping
Returns:
true if the field is embedded into one column

populateOwnerInStatement

protected int populateOwnerInStatement(org.jpox.StateManager sm,
                                       org.jpox.ObjectManager om,
                                       java.sql.PreparedStatement ps,
                                       int jdbcPosition)
Convenience method to populate the passed PreparedStatement with the value from the owner.

Parameters:
sm - State Manager
om - Object Manager
ps - The PreparedStatement
jdbcPosition - Position in JDBC statement to populate
Returns:
The next position in the JDBC statement

getStateManagerForEmbeddedPCObject

protected org.jpox.StateManager getStateManagerForEmbeddedPCObject(org.jpox.StateManager sm,
                                                                   java.lang.Object obj,
                                                                   JoinTable table)
Method to return the StateManager for an embedded PC object (element, key, value). It creates one if the element is not currently managed.

Parameters:
sm - State Manager of the owner
obj - The embedded PC object
table - Join table where the objects are stored
Returns:
The state manager

allowsBatching

protected boolean allowsBatching()
Convenience method to return if the RDBMS supports batching and the user wants batching.

Returns:
If batching of statements is permissible


Copyright © -2008 . All Rights Reserved.