org.jboss.ejb.plugins.cmp.jdbc.bridge
Interface JDBCCMPFieldBridge

All Superinterfaces:
CMPFieldBridge, FieldBridge, JDBCFieldBridge
All Known Implementing Classes:
JDBCAbstractCMPFieldBridge

public interface JDBCCMPFieldBridge
extends JDBCFieldBridge, CMPFieldBridge

JDBCCMPFieldBridge represents one CMP field. This implementations of this interface handles setting are responsible for setting statement parameters and loading results for instance values and primary keys. Life-cycle: Tied to the EntityBridge. Multiplicity: One for each entity bean cmp field.

Version:
$Revision: 1.11.4.8 $
Author:
Dain Sundstrom, Alex Loubyansky

Method Summary
 void addDefaultFlag(byte flag)
          TODO: Get rid of it
 byte getDefaultFlags()
          Returns the default field flags.
 Object getLockedValue(EntityEnterpriseContext ctx)
           
 Field getPrimaryKeyField()
          Gets the field of the primary key object in which the value of this field is stored.
 Object getPrimaryKeyValue(Object primaryKey)
          Gets the value of this field in the specified primaryKey object.
 int getTableIndex()
          The index of the field among the table fields.
 boolean isRelationTableField()
           
 int loadPrimaryKeyResults(ResultSet rs, int parameterIndex, Object[] pkRef)
          Loads the data from result set into the primary key object.
 void lockInstanceValue(EntityEnterpriseContext ctx)
          Optimistically locks field value.
 int setArgumentParameters(PreparedStatement ps, int parameterIndex, Object arg)
          Sets the prepared statement parameters with the data from the object.
 void setLockingStrategy(LockingStrategy lockingStrategy)
           
 int setPrimaryKeyParameters(PreparedStatement ps, int parameterIndex, Object primaryKey)
          Sets the prepared statement parameters with the data from the primary key.
 Object setPrimaryKeyValue(Object primaryKey, Object value)
          Sets the value of this field to the specified value in the specified primaryKey object.
 
Methods inherited from interface org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCFieldBridge
getInstanceValue, getJDBCType, getManager, initInstance, isCMPField, isDirty, isLoaded, isPrimaryKeyMember, isReadOnly, isReadTimedOut, loadArgumentResults, loadInstanceResults, resetPersistenceContext, setClean, setInstanceParameters, setInstanceValue
 
Methods inherited from interface org.jboss.ejb.plugins.cmp.bridge.FieldBridge
getFieldName, getValue, setValue
 
Methods inherited from interface org.jboss.ejb.plugins.cmp.bridge.CMPFieldBridge
getFieldType
 

Method Detail

getTableIndex

public int getTableIndex()
The index of the field among the table fields.


getDefaultFlags

public byte getDefaultFlags()
Returns the default field flags.


addDefaultFlag

public void addDefaultFlag(byte flag)
TODO: Get rid of it

Parameters:
flag -

getLockedValue

public Object getLockedValue(EntityEnterpriseContext ctx)
Parameters:
ctx - instance's context
Returns:
field value that was locked.

lockInstanceValue

public void lockInstanceValue(EntityEnterpriseContext ctx)
Optimistically locks field value.


setLockingStrategy

public void setLockingStrategy(LockingStrategy lockingStrategy)
Parameters:
lockingStrategy - locking strategy assigned to the field

getPrimaryKeyField

public Field getPrimaryKeyField()
Gets the field of the primary key object in which the value of this field is stored.


getPrimaryKeyValue

public Object getPrimaryKeyValue(Object primaryKey)
                          throws IllegalArgumentException
Gets the value of this field in the specified primaryKey object.

Specified by:
getPrimaryKeyValue in interface JDBCFieldBridge
Parameters:
primaryKey - the primary key object from which this fields value will be extracted
Returns:
the value of this field in the primaryKey object
Throws:
IllegalArgumentException

isRelationTableField

public boolean isRelationTableField()
Returns:
true if the field belongs to a relation table

setPrimaryKeyValue

public Object setPrimaryKeyValue(Object primaryKey,
                                 Object value)
                          throws IllegalArgumentException
Sets the value of this field to the specified value in the specified primaryKey object.

Parameters:
primaryKey - the primary key object which the value will be inserted
value - the value for field that will be set in the pk
Returns:
the updated primary key object; the actual object may change not just the value
Throws:
IllegalArgumentException

setPrimaryKeyParameters

public int setPrimaryKeyParameters(PreparedStatement ps,
                                   int parameterIndex,
                                   Object primaryKey)
                            throws IllegalArgumentException
Sets the prepared statement parameters with the data from the primary key.

Throws:
IllegalArgumentException

setArgumentParameters

public int setArgumentParameters(PreparedStatement ps,
                                 int parameterIndex,
                                 Object arg)
Sets the prepared statement parameters with the data from the object. The object must be the type of this field.


loadPrimaryKeyResults

public int loadPrimaryKeyResults(ResultSet rs,
                                 int parameterIndex,
                                 Object[] pkRef)
                          throws IllegalArgumentException
Loads the data from result set into the primary key object.

Throws:
IllegalArgumentException


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.