org.datanucleus.store.rdbms.scostore
Class BackingStoreHelper

java.lang.Object
  extended by org.datanucleus.store.rdbms.scostore.BackingStoreHelper

public class BackingStoreHelper
extends java.lang.Object

Series of helper methods for use with RDBMS backing stores.


Constructor Summary
BackingStoreHelper()
           
 
Method Summary
static int populateElementDiscriminatorInStatement(org.datanucleus.ObjectManager om, java.sql.PreparedStatement ps, int jdbcPosition, boolean includeSubclasses, org.datanucleus.store.mapped.scostore.ElementContainerStore.ElementInfo info, org.datanucleus.ClassLoaderResolver clr)
          Convenience method to populate the passed PreparedStatement with the value from the element discriminator, optionally including all subclasses of the element type.
static int populateElementInStatement(org.datanucleus.ObjectManager om, java.lang.Object ps, java.lang.Object element, int jdbcPosition, org.datanucleus.store.mapped.mapping.JavaTypeMapping elementMapping)
          Convenience method to populate the passed PreparedStatement with the value for the element.
static int populateEmbeddedElementFieldsInStatement(org.datanucleus.StateManager sm, java.lang.Object element, java.lang.Object ps, int jdbcPosition, org.datanucleus.metadata.AbstractMemberMetaData ownerFieldMetaData, org.datanucleus.store.mapped.mapping.JavaTypeMapping elementMapping, org.datanucleus.metadata.AbstractClassMetaData emd, org.datanucleus.store.mapped.scostore.BaseContainerStore bcs)
          Convenience method to populate the passed PreparedStatement with the field values from the embedded element starting at the specified jdbc position.
static int populateEmbeddedKeyFieldsInStatement(org.datanucleus.StateManager sm, java.lang.Object key, java.sql.PreparedStatement ps, int jdbcPosition, JoinTable joinTable, org.datanucleus.store.mapped.scostore.AbstractMapStore mapStore)
          Convenience method to populate the passed PreparedStatement with the field values from the embedded map key starting at the specified jdbc position.
static int populateEmbeddedValueFieldsInStatement(org.datanucleus.StateManager sm, java.lang.Object value, java.sql.PreparedStatement ps, int jdbcPosition, JoinTable joinTable, org.datanucleus.store.mapped.scostore.AbstractMapStore mapStore)
          Convenience method to populate the passed PreparedStatement with the field values from the embedded map value starting at the specified jdbc position.
static int populateKeyInStatement(org.datanucleus.ObjectManager om, java.sql.PreparedStatement ps, java.lang.Object key, int jdbcPosition, org.datanucleus.store.mapped.mapping.JavaTypeMapping keyMapping)
          Convenience method to populate the passed PreparedStatement with the value for the map key.
static int populateOrderInStatement(org.datanucleus.ObjectManager om, java.lang.Object ps, int idx, int jdbcPosition, org.datanucleus.store.mapped.mapping.JavaTypeMapping orderMapping)
          Convenience method to populate the passed PreparedStatement with the value for the order index.
static int populateOwnerInStatement(org.datanucleus.StateManager sm, org.datanucleus.ObjectManager om, java.lang.Object ps, int jdbcPosition, org.datanucleus.store.mapped.scostore.BaseContainerStore bcs)
          Convenience method to populate the passed PreparedStatement with the value from the owner.
static int populateRelationDiscriminatorInStatement(org.datanucleus.ObjectManager om, java.sql.PreparedStatement ps, int jdbcPosition, org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
          Convenience method to populate the passed PreparedStatement with the value for the distinguisher value.
static int populateValueInStatement(org.datanucleus.ObjectManager om, java.sql.PreparedStatement ps, java.lang.Object value, int jdbcPosition, org.datanucleus.store.mapped.mapping.JavaTypeMapping valueMapping)
          Convenience method to populate the passed PreparedStatement with the value for the map value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BackingStoreHelper

public BackingStoreHelper()
Method Detail

populateOwnerInStatement

public static int populateOwnerInStatement(org.datanucleus.StateManager sm,
                                           org.datanucleus.ObjectManager om,
                                           java.lang.Object ps,
                                           int jdbcPosition,
                                           org.datanucleus.store.mapped.scostore.BaseContainerStore bcs)
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

populateRelationDiscriminatorInStatement

public static int populateRelationDiscriminatorInStatement(org.datanucleus.ObjectManager om,
                                                           java.sql.PreparedStatement ps,
                                                           int jdbcPosition,
                                                           org.datanucleus.store.mapped.scostore.ElementContainerStore ecs)
Convenience method to populate the passed PreparedStatement with the value for the distinguisher value.

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

populateOrderInStatement

public static int populateOrderInStatement(org.datanucleus.ObjectManager om,
                                           java.lang.Object ps,
                                           int idx,
                                           int jdbcPosition,
                                           org.datanucleus.store.mapped.mapping.JavaTypeMapping orderMapping)
Convenience method to populate the passed PreparedStatement with the value for the order index.

Parameters:
om - Object Manager
ps - The PreparedStatement
idx - The order value
jdbcPosition - Position in JDBC statement to populate
orderMapping - The order mapping
Returns:
The next position in the JDBC statement

populateElementInStatement

public static int populateElementInStatement(org.datanucleus.ObjectManager om,
                                             java.lang.Object ps,
                                             java.lang.Object element,
                                             int jdbcPosition,
                                             org.datanucleus.store.mapped.mapping.JavaTypeMapping elementMapping)
Convenience method to populate the passed PreparedStatement with the value for the element. Not used with embedded PC elements.

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

populateKeyInStatement

public static int populateKeyInStatement(org.datanucleus.ObjectManager om,
                                         java.sql.PreparedStatement ps,
                                         java.lang.Object key,
                                         int jdbcPosition,
                                         org.datanucleus.store.mapped.mapping.JavaTypeMapping keyMapping)
Convenience method to populate the passed PreparedStatement with the value for the map key. Not used with embedded PC keys.

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

populateValueInStatement

public static int populateValueInStatement(org.datanucleus.ObjectManager om,
                                           java.sql.PreparedStatement ps,
                                           java.lang.Object value,
                                           int jdbcPosition,
                                           org.datanucleus.store.mapped.mapping.JavaTypeMapping valueMapping)
Convenience method to populate the passed PreparedStatement with the value for the map value. Not used with embedded PC values.

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

populateElementDiscriminatorInStatement

public static int populateElementDiscriminatorInStatement(org.datanucleus.ObjectManager om,
                                                          java.sql.PreparedStatement ps,
                                                          int jdbcPosition,
                                                          boolean includeSubclasses,
                                                          org.datanucleus.store.mapped.scostore.ElementContainerStore.ElementInfo info,
                                                          org.datanucleus.ClassLoaderResolver clr)
Convenience method to populate the passed PreparedStatement with the value from the element discriminator, optionally including all subclasses of the element type.

Parameters:
om - Object Manager
ps - The PreparedStatement
jdbcPosition - Position in JDBC statement to populate
includeSubclasses - Whether to include subclasses
info - The element information
clr - ClassLoader resolver
Returns:
The next position in the JDBC statement

populateEmbeddedElementFieldsInStatement

public static int populateEmbeddedElementFieldsInStatement(org.datanucleus.StateManager sm,
                                                           java.lang.Object element,
                                                           java.lang.Object ps,
                                                           int jdbcPosition,
                                                           org.datanucleus.metadata.AbstractMemberMetaData ownerFieldMetaData,
                                                           org.datanucleus.store.mapped.mapping.JavaTypeMapping elementMapping,
                                                           org.datanucleus.metadata.AbstractClassMetaData emd,
                                                           org.datanucleus.store.mapped.scostore.BaseContainerStore bcs)
Convenience method to populate the passed PreparedStatement with the field values from the embedded element starting at the specified jdbc position.

Parameters:
sm - State Manager of the owning container
element - The embedded element
ps - The PreparedStatement
jdbcPosition - JDBC position in the statement to start at
ownerFieldMetaData - The meta data for the owner field
bcs - Container store
Returns:
The next JDBC position

populateEmbeddedKeyFieldsInStatement

public static int populateEmbeddedKeyFieldsInStatement(org.datanucleus.StateManager sm,
                                                       java.lang.Object key,
                                                       java.sql.PreparedStatement ps,
                                                       int jdbcPosition,
                                                       JoinTable joinTable,
                                                       org.datanucleus.store.mapped.scostore.AbstractMapStore mapStore)
Convenience method to populate the passed PreparedStatement with the field values from the embedded map key starting at the specified jdbc position.

Parameters:
sm - State Manager of the owning container
key - The embedded key
ps - The PreparedStatement
jdbcPosition - JDBC position in the statement to start at
joinTable - The Join table where the values are embedded
mapStore - the map store
Returns:
The next JDBC position

populateEmbeddedValueFieldsInStatement

public static int populateEmbeddedValueFieldsInStatement(org.datanucleus.StateManager sm,
                                                         java.lang.Object value,
                                                         java.sql.PreparedStatement ps,
                                                         int jdbcPosition,
                                                         JoinTable joinTable,
                                                         org.datanucleus.store.mapped.scostore.AbstractMapStore mapStore)
Convenience method to populate the passed PreparedStatement with the field values from the embedded map value starting at the specified jdbc position.

Parameters:
sm - State Manager of the owning container
value - The embedded value
ps - The PreparedStatement
jdbcPosition - JDBC position in the statement to start at
joinTable - The Join table where the values are embedded
mapStore - The map store
Returns:
The next JDBC position


Copyright © 2009. All Rights Reserved.