站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 server API Documentation 英文版文档

JDBCEntityBridge (JBoss Server API) - JBoss 4.0.1 sp1 server API Documentation 英文版文档


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

java.lang.Object
  extended byorg.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge
All Implemented Interfaces:
EntityBridge, JDBCAbstractEntityBridge

public class JDBCEntityBridge
extends Object
implements JDBCAbstractEntityBridge

JDBCEntityBridge follows the Bridge pattern [Gamma et. al, 1995]. The main job of this class is to construct the bridge from entity meta data. Life-cycle: Undefined. Should be tied to CMPStoreManager. Multiplicity: One per cmp entity bean type.

Version:
$Revision: 1.53 $
Author:
Dain Sundstrom, Alex Loubyansky, Heiko W. Rupp

Nested Class Summary
 class JDBCEntityBridge.EntityState
           
static interface JDBCEntityBridge.FieldIterator
           
 
Field Summary
static byte ADD_TO_SET_ON_UPDATE
           
static byte ADD_TO_WHERE_ON_UPDATE
           
static byte CHECK_DIRTY
           
static byte DIRTY
           
static JDBCEntityBridge.FieldIterator EMPTY_FIELD_ITERATOR
           
static byte LOAD_REQUIRED
           
static byte LOADED
           
static byte LOCKED
           
 
Constructor Summary
JDBCEntityBridge(JDBCEntityMetaData metadata, JDBCStoreManager manager)
           
 
Method Summary
 void cascadeDelete(EntityEnterpriseContext ctx, Map oldRelations)
           
 Object createPrimaryKeyInstance()
           
static void destroyPersistenceContext(EntityEnterpriseContext ctx)
           
 Object extractPrimaryKeyFromInstance(EntityEnterpriseContext ctx)
           
 String getAbstractSchemaName()
           
 JDBCCMPFieldBridge getCMPFieldByName(String name)
           
 JDBCCMRFieldBridge getCMRFieldByName(String name)
           
 JDBCAbstractCMRFieldBridge[] getCMRFields()
           
 JDBCCMPFieldBridge getCreatedPrincipalField()
           
 JDBCCMPFieldBridge getCreatedTimeField()
           
 DataSource getDataSource()
          Returns the datasource for this entity.
 JDBCEntityBridge.FieldIterator getDirtyIterator(EntityEnterpriseContext ctx)
           
 boolean[] getEagerLoadMask()
           
 String getEntityName()
           
 int getFetchSize()
           
 FieldBridge getFieldByName(String name)
           
 List getFields()
          This method is called only at deployment time, not called at runtime.
 Iterator getLazyLoadGroupMasks()
           
 int getListCacheMax()
           
 boolean[] getLoadGroupMask(String name)
           
 JDBCEntityBridge.FieldIterator getLoadIterator(JDBCCMPFieldBridge requiredField, JDBCReadAheadMetaData readahead, EntityEnterpriseContext ctx)
           
 Class getLocalInterface()
           
 JDBCEntityBridge.FieldIterator getLockedIterator(EntityEnterpriseContext ctx)
           
 JDBCEntityPersistenceStore getManager()
           
 JDBCEntityMetaData getMetaData()
           
 Class getPrimaryKeyClass()
           
 JDBCFieldBridge[] getPrimaryKeyFields()
           
 String getQualifiedTableName()
           
 Class getRemoteInterface()
           
 Collection getSelectors()
           
 JDBCFieldBridge[] getTableFields()
           
 String getTableName()
           
 JDBCCMPFieldBridge getUpdatedPrincipalField()
           
 JDBCCMPFieldBridge getUpdatedTimeField()
           
 JDBCCMPFieldBridge getVersionField()
           
 boolean hasLockedFields(EntityEnterpriseContext ctx)
           
 void init()
           
 void initInstance(EntityEnterpriseContext ctx)
           
 void initPersistenceContext(EntityEnterpriseContext ctx)
           
 void injectPrimaryKeyIntoInstance(EntityEnterpriseContext ctx, Object pk)
           
static boolean isEjbCreateDone(EntityEnterpriseContext ctx)
           
 boolean isModified(EntityEnterpriseContext ctx)
          This method is used to determined whether the instance was modified.
 boolean isRemoved(EntityEnterpriseContext ctx)
           
 boolean isScheduledForBatchCascadeDelete(EntityEnterpriseContext ctx)
           
 boolean isScheduledForCascadeDelete(EntityEnterpriseContext ctx)
           
 boolean isStoreRequired(EntityEnterpriseContext ctx)
           
 int loadPrimaryKeyResults(ResultSet rs, int parameterIndex, Object[] pkRef)
           
 boolean removeFromRelations(EntityEnterpriseContext ctx, Object[] oldRelations)
           
 void resetPersistenceContext(EntityEnterpriseContext ctx)
          This is only called in commit option B
 void resolveRelationships()
           
 void scheduleForBatchCascadeDelete(EntityEnterpriseContext ctx)
          Marks the instance as scheduled for batch cascade delete (not for cascade delete)
 void scheduleForCascadeDelete(EntityEnterpriseContext ctx)
          Marks the instance as scheduled for cascade delete (not for batch cascade delete)
static void setCreated(EntityEnterpriseContext ctx)
           
static void setEjbCreateDone(EntityEnterpriseContext ctx)
           
 int setPrimaryKeyParameters(PreparedStatement ps, int parameterIndex, Object primaryKey)
           
 void setRemoved(EntityEnterpriseContext ctx)
          Marks the context as removed.
 void start()
          The third phase of deployment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOADED

public static final byte LOADED
See Also:
Constant Field Values

LOAD_REQUIRED

public static final byte LOAD_REQUIRED
See Also:
Constant Field Values

DIRTY

public static final byte DIRTY
See Also:
Constant Field Values

CHECK_DIRTY

public static final byte CHECK_DIRTY
See Also:
Constant Field Values

LOCKED

public static final byte LOCKED
See Also:
Constant Field Values

ADD_TO_SET_ON_UPDATE

public static final byte ADD_TO_SET_ON_UPDATE
See Also:
Constant Field Values

ADD_TO_WHERE_ON_UPDATE

public static final byte ADD_TO_WHERE_ON_UPDATE
See Also:
Constant Field Values

EMPTY_FIELD_ITERATOR

public static final JDBCEntityBridge.FieldIterator EMPTY_FIELD_ITERATOR
Constructor Detail

JDBCEntityBridge

public JDBCEntityBridge(JDBCEntityMetaData metadata,
                        JDBCStoreManager manager)
                 throws org.jboss.deployment.DeploymentException
Method Detail

init

public void init()
          throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException

resolveRelationships

public void resolveRelationships()
                          throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException

start

public void start()
           throws org.jboss.deployment.DeploymentException
The third phase of deployment. The method is called when relationships are already resolved.

Throws:
org.jboss.deployment.DeploymentException

removeFromRelations

public boolean removeFromRelations(EntityEnterpriseContext ctx,
                                   Object[] oldRelations)

cascadeDelete

public void cascadeDelete(EntityEnterpriseContext ctx,
                          Map oldRelations)
                   throws javax.ejb.RemoveException,
                          RemoteException
Throws:
javax.ejb.RemoveException
RemoteException

getEntityName

public String getEntityName()
Specified by:
getEntityName in interface EntityBridge

getAbstractSchemaName

public String getAbstractSchemaName()
Specified by:
getAbstractSchemaName in interface EntityBridge

getRemoteInterface

public Class getRemoteInterface()
Specified by:
getRemoteInterface in interface EntityBridge

getLocalInterface

public Class getLocalInterface()
Specified by:
getLocalInterface in interface EntityBridge

getMetaData

public JDBCEntityMetaData getMetaData()
Specified by:
getMetaData in interface JDBCAbstractEntityBridge

getManager

public JDBCEntityPersistenceStore getManager()
Specified by:
getManager in interface JDBCAbstractEntityBridge

getDataSource

public DataSource getDataSource()
Returns the datasource for this entity.

Specified by:
getDataSource in interface JDBCAbstractEntityBridge

getTableName

public String getTableName()
Specified by:
getTableName in interface JDBCAbstractEntityBridge

getQualifiedTableName

public String getQualifiedTableName()
Specified by:
getQualifiedTableName in interface JDBCAbstractEntityBridge

getPrimaryKeyClass

public Class getPrimaryKeyClass()

getListCacheMax

public int getListCacheMax()

getFetchSize

public int getFetchSize()

createPrimaryKeyInstance

public Object createPrimaryKeyInstance()

getPrimaryKeyFields

public JDBCFieldBridge[] getPrimaryKeyFields()
Specified by:
getPrimaryKeyFields in interface JDBCAbstractEntityBridge

getFields

public List getFields()
This method is called only at deployment time, not called at runtime.

Returns:
the list of all the fields.

getFieldByName

public FieldBridge getFieldByName(String name)
Specified by:
getFieldByName in interface EntityBridge

getEagerLoadMask

public boolean[] getEagerLoadMask()

getLazyLoadGroupMasks

public Iterator getLazyLoadGroupMasks()

getLoadGroupMask

public boolean[] getLoadGroupMask(String name)
Specified by:
getLoadGroupMask in interface JDBCAbstractEntityBridge

getLoadIterator

public JDBCEntityBridge.FieldIterator getLoadIterator(JDBCCMPFieldBridge requiredField,
                                                      JDBCReadAheadMetaData readahead,
                                                      EntityEnterpriseContext ctx)

getCMPFieldByName

public JDBCCMPFieldBridge getCMPFieldByName(String name)
Parameters:
name - CMP field name
Returns:
JDBCCMPFieldBridge instance or null if no field found.

getCMRFields

public JDBCAbstractCMRFieldBridge[] getCMRFields()
Specified by:
getCMRFields in interface JDBCAbstractEntityBridge

getCMRFieldByName

public JDBCCMRFieldBridge getCMRFieldByName(String name)

getVersionField

public JDBCCMPFieldBridge getVersionField()

getCreatedPrincipalField

public JDBCCMPFieldBridge getCreatedPrincipalField()

getCreatedTimeField

public JDBCCMPFieldBridge getCreatedTimeField()

getUpdatedPrincipalField

public JDBCCMPFieldBridge getUpdatedPrincipalField()

getUpdatedTimeField

public JDBCCMPFieldBridge getUpdatedTimeField()

getSelectors

public Collection getSelectors()

initInstance

public void initInstance(EntityEnterpriseContext ctx)

isEjbCreateDone

public static boolean isEjbCreateDone(EntityEnterpriseContext ctx)

setCreated

public static void setCreated(EntityEnterpriseContext ctx)

setEjbCreateDone

public static void setEjbCreateDone(EntityEnterpriseContext ctx)

isModified

public boolean isModified(EntityEnterpriseContext ctx)
This method is used to determined whether the instance was modified. NOTE, even if the method returns true the isStoreRequired for this same instance might return false, e.g. a CMR field that doesn't have a foreign key was modified.

Parameters:
ctx -
Returns:

isStoreRequired

public boolean isStoreRequired(EntityEnterpriseContext ctx)

getDirtyIterator

public JDBCEntityBridge.FieldIterator getDirtyIterator(EntityEnterpriseContext ctx)

hasLockedFields

public boolean hasLockedFields(EntityEnterpriseContext ctx)

getLockedIterator

public JDBCEntityBridge.FieldIterator getLockedIterator(EntityEnterpriseContext ctx)

initPersistenceContext

public void initPersistenceContext(EntityEnterpriseContext ctx)

resetPersistenceContext

public void resetPersistenceContext(EntityEnterpriseContext ctx)
This is only called in commit option B


destroyPersistenceContext

public static void destroyPersistenceContext(EntityEnterpriseContext ctx)

setPrimaryKeyParameters

public int setPrimaryKeyParameters(PreparedStatement ps,
                                   int parameterIndex,
                                   Object primaryKey)

loadPrimaryKeyResults

public int loadPrimaryKeyResults(ResultSet rs,
                                 int parameterIndex,
                                 Object[] pkRef)

extractPrimaryKeyFromInstance

public Object extractPrimaryKeyFromInstance(EntityEnterpriseContext ctx)

injectPrimaryKeyIntoInstance

public void injectPrimaryKeyIntoInstance(EntityEnterpriseContext ctx,
                                         Object pk)

getTableFields

public JDBCFieldBridge[] getTableFields()
Specified by:
getTableFields in interface JDBCAbstractEntityBridge

setRemoved

public void setRemoved(EntityEnterpriseContext ctx)
Marks the context as removed.

Parameters:
ctx - instance's context

isRemoved

public boolean isRemoved(EntityEnterpriseContext ctx)
Parameters:
ctx - instance's context.
Returns:
true if instance was removed.

scheduleForCascadeDelete

public void scheduleForCascadeDelete(EntityEnterpriseContext ctx)
Marks the instance as scheduled for cascade delete (not for batch cascade delete)

Parameters:
ctx - instance's context.

isScheduledForCascadeDelete

public boolean isScheduledForCascadeDelete(EntityEnterpriseContext ctx)
Parameters:
ctx - instance's context.
Returns:
true if instance was scheduled for cascade delete (not for batch cascade delete)

scheduleForBatchCascadeDelete

public void scheduleForBatchCascadeDelete(EntityEnterpriseContext ctx)
Marks the instance as scheduled for batch cascade delete (not for cascade delete)

Parameters:
ctx - instance's context.

isScheduledForBatchCascadeDelete

public boolean isScheduledForBatchCascadeDelete(EntityEnterpriseContext ctx)
Parameters:
ctx - instance's context.
Returns:
true if instance was scheduled for batch cascade delete (not for cascade delete)


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