org.jboss.ejb.plugins.cmp.jdbc.bridge
Class JDBCCMP2xFieldBridge

java.lang.Object
  extended by org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge
      extended by org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge
All Implemented Interfaces:
CMPFieldBridge, FieldBridge, JDBCCMPFieldBridge, JDBCFieldBridge
Direct Known Subclasses:
JDBCCMP2xAutoUpdatedFieldBridge

public class JDBCCMP2xFieldBridge
extends JDBCAbstractCMPFieldBridge

JDBCCMP2xFieldBridge is a concrete implementation of JDBCCMPFieldBridge for CMP version 2.x. Instance data is stored in the entity persistence context. Whenever a field is changed it is compared to the current value and sets a dirty flag if the value has changed. Life-cycle: Tied to the EntityBridge. Multiplicity: One for each entity bean cmp field.

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

Field Summary
 
Fields inherited from class org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge
checkDirtyAfterGet, defaultFlags, fieldName, jdbcContextIndex, log, manager, primaryKeyMember, readOnly, readTimeOut, stateFactory, tableIndex
 
Constructor Summary
JDBCCMP2xFieldBridge(JDBCCMP2xFieldBridge cmpField, CMPFieldStateFactory stateFactory, boolean checkDirtyAfterGet)
           
JDBCCMP2xFieldBridge(JDBCStoreManager manager, JDBCCMPFieldMetaData metadata)
           
JDBCCMP2xFieldBridge(JDBCStoreManager manager, JDBCCMPFieldMetaData metadata, CMPFieldStateFactory stateFactory, boolean checkDirtyAfterGet)
           
JDBCCMP2xFieldBridge(JDBCStoreManager manager, JDBCCMPFieldMetaData metadata, JDBCType jdbcType)
          This constructor creates a foreign key field.
JDBCCMP2xFieldBridge(JDBCStoreManager manager, String fieldName, Class fieldType, JDBCType jdbcType, boolean readOnly, long readTimeOut, Class primaryKeyClass, Field primaryKeyField, JDBCCMP2xFieldBridge cmpFieldIAmMappedTo, JDBCCMRFieldBridge myCMRField, String columnName)
          This constructor is used to create a foreign key field instance that is a part of primary key field.
 
Method Summary
 JDBCCMP2xFieldBridge getCmpFieldIAmMappedTo()
           
 org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.ChainLink getCmrChainLink()
           
 String getColumnName()
           
 Object getInstanceValue(EntityEnterpriseContext ctx)
          Gets the internal value of this field without user level checks.
 Object getLockedValue(EntityEnterpriseContext ctx)
           
 boolean isDirty(EntityEnterpriseContext ctx)
          Has the value of this field changes since the last time clean was called.
 boolean isFKFieldMappedToCMPField()
           
 boolean isLoaded(EntityEnterpriseContext ctx)
          Has the data been loaded?
 boolean isReadTimedOut(EntityEnterpriseContext ctx)
          Has current data read timed out?
 void lockInstanceValue(EntityEnterpriseContext ctx)
          Optimistically locks field value.
 void resetPersistenceContext(EntityEnterpriseContext ctx)
          Resets any persistence data maintained in the context.
 void setClean(EntityEnterpriseContext ctx)
          Mark this field as clean.
protected  void setDirtyAfterGet(EntityEnterpriseContext ctx)
           
 void setInstanceValue(EntityEnterpriseContext ctx, Object value)
          Sets the internal value of this field without user level checks.
 void updateState(EntityEnterpriseContext ctx, Object value)
           
 
Methods inherited from class org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCAbstractCMPFieldBridge
addDefaultFlag, getDefaultFlags, getFieldIndex, getFieldName, getFieldType, getJDBCType, getManager, getPrimaryKeyClass, getPrimaryKeyField, getPrimaryKeyValue, getReadTimeOut, getTableIndex, getValue, initInstance, isCMPField, isPrimaryKeyMember, isReadOnly, isRelationTableField, loadArgumentResults, loadInstanceResults, loadPrimaryKeyResults, setArgumentParameters, setInstanceParameters, setLockingStrategy, setPrimaryKeyParameters, setPrimaryKeyValue, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCCMP2xFieldBridge

public JDBCCMP2xFieldBridge(JDBCStoreManager manager,
                            JDBCCMPFieldMetaData metadata)
                     throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException

JDBCCMP2xFieldBridge

public JDBCCMP2xFieldBridge(JDBCStoreManager manager,
                            JDBCCMPFieldMetaData metadata,
                            CMPFieldStateFactory stateFactory,
                            boolean checkDirtyAfterGet)
                     throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException

JDBCCMP2xFieldBridge

public JDBCCMP2xFieldBridge(JDBCCMP2xFieldBridge cmpField,
                            CMPFieldStateFactory stateFactory,
                            boolean checkDirtyAfterGet)
                     throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException

JDBCCMP2xFieldBridge

public JDBCCMP2xFieldBridge(JDBCStoreManager manager,
                            JDBCCMPFieldMetaData metadata,
                            JDBCType jdbcType)
                     throws org.jboss.deployment.DeploymentException
This constructor creates a foreign key field.

Throws:
org.jboss.deployment.DeploymentException

JDBCCMP2xFieldBridge

public JDBCCMP2xFieldBridge(JDBCStoreManager manager,
                            String fieldName,
                            Class fieldType,
                            JDBCType jdbcType,
                            boolean readOnly,
                            long readTimeOut,
                            Class primaryKeyClass,
                            Field primaryKeyField,
                            JDBCCMP2xFieldBridge cmpFieldIAmMappedTo,
                            JDBCCMRFieldBridge myCMRField,
                            String columnName)
                     throws org.jboss.deployment.DeploymentException
This constructor is used to create a foreign key field instance that is a part of primary key field. See JDBCCMRFieldBridge.

Throws:
org.jboss.deployment.DeploymentException
Method Detail

getCmpFieldIAmMappedTo

public JDBCCMP2xFieldBridge getCmpFieldIAmMappedTo()

getCmrChainLink

public org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCCMP2xFieldBridge.ChainLink getCmrChainLink()

isFKFieldMappedToCMPField

public boolean isFKFieldMappedToCMPField()

getColumnName

public String getColumnName()

getInstanceValue

public Object getInstanceValue(EntityEnterpriseContext ctx)
Description copied from interface: JDBCFieldBridge
Gets the internal value of this field without user level checks.

Parameters:
ctx - the context for which this field's value should be fetched
Returns:
the value of this field

setInstanceValue

public void setInstanceValue(EntityEnterpriseContext ctx,
                             Object value)
Description copied from interface: JDBCFieldBridge
Sets the internal value of this field without user level checks.

Parameters:
ctx - the context for which this field's value should be set
value - the new value of this field

lockInstanceValue

public void lockInstanceValue(EntityEnterpriseContext ctx)
Description copied from interface: JDBCCMPFieldBridge
Optimistically locks field value.


isLoaded

public boolean isLoaded(EntityEnterpriseContext ctx)
Description copied from interface: JDBCFieldBridge
Has the data been loaded?


isDirty

public boolean isDirty(EntityEnterpriseContext ctx)
Has the value of this field changes since the last time clean was called.


setClean

public void setClean(EntityEnterpriseContext ctx)
Mark this field as clean. Saves the current state in context, so it can be compared when isDirty is called.


resetPersistenceContext

public void resetPersistenceContext(EntityEnterpriseContext ctx)
Description copied from interface: JDBCFieldBridge
Resets any persistence data maintained in the context.

Specified by:
resetPersistenceContext in interface JDBCFieldBridge
Specified by:
resetPersistenceContext in class JDBCAbstractCMPFieldBridge

isReadTimedOut

public boolean isReadTimedOut(EntityEnterpriseContext ctx)
Description copied from interface: JDBCFieldBridge
Has current data read timed out?


getLockedValue

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

updateState

public void updateState(EntityEnterpriseContext ctx,
                        Object value)

setDirtyAfterGet

protected void setDirtyAfterGet(EntityEnterpriseContext ctx)
Specified by:
setDirtyAfterGet in class JDBCAbstractCMPFieldBridge


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