org.jboss.ejb.plugins.cmp.jdbc.metadata
Class JDBCEntityMetaData

java.lang.Object
  extended byorg.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData

public final class JDBCEntityMetaData
extends java.lang.Object

This immutable class contains information about an entity


Constructor Summary
JDBCEntityMetaData(JDBCApplicationMetaData (src)  jdbcApplication, org.w3c.dom.Element element, JDBCEntityMetaData (src)  defaultValues)
          Constructs entity meta data with the data contained in the entity xml element from a jbosscmp-jdbc xml file.
JDBCEntityMetaData(JDBCApplicationMetaData (src)  jdbcApplication, EntityMetaData (src)  entity)
          Constructs jdbc entity meta data defined in the jdbcApplication and with the data from the entity meta data which is loaded from the ejb-jar.xml file.
 
Method Summary
 boolean equals(java.lang.Object o)
          Compares this JDBCEntityMetaData against the specified object.
 java.lang.String getAbstractSchemaName()
          Gets the abstract shcema name of this entity.
 boolean getAlterTable()
          Gets the flag used to determine if the store manager should attempt to alter table when the entity is deployed.
 JDBCAuditMetaData (src) getAudit()
          Returns audit metadata
 java.lang.ClassLoader getClassLoader()
          Gets the class loaded which is used to load all classes used by this entity
 JDBCCMPFieldMetaData (src) getCMPFieldByName(java.lang.String name)
          Gets the cmp field with the specified name
 java.util.List getCMPFields()
          Gets the cmp fields of this entity
 boolean getCreateTable()
          Gets the flag used to determine if the store manager should attempt to create database table when the entity is deployed.
 java.lang.String getDataSourceName()
          Gets the name of the datasource in jndi for this entity
 java.lang.String getDefaultTableName()
          Gets the name of the table to which this entity is persisted
 java.util.ArrayList getDefaultTablePostCreateCmd()
          Get the (user-defined) SQL commands that sould be issued after table creation
 java.lang.String getEagerLoadGroup()
          Gets the name of the eager load group.
 java.lang.Class getEntityClass()
          Gets the implementation class of this entity
 JDBCEntityCommandMetaData (src) getEntityCommand()
          Gets the entity command metadata
 int getFetchSize()
          The number of rows that the database driver should get in a single trip to the database.
 java.lang.Class getHomeClass()
          Gets the home class of this entity
 JDBCApplicationMetaData (src) getJDBCApplication()
          Gets the meta data for the application of which this entity is a member.
 java.util.List getLazyLoadGroups()
          Gets the collection of lazy load group names.
 int getListCacheMax()
          The maximum number of qurey result lists that will be tracked.
 java.util.List getLoadGroup(java.lang.String name)
          Gets the load group with the specified name.
 java.util.Map getLoadGroups()
          Gets the map from load grou name to a List of field names, which forms a logical load group.
 java.lang.Class getLocalClass()
          Gets the local class of this entity
 java.lang.Class getLocalHomeClass()
          Gets the local home class of this entity
 java.lang.String getName()
          Gets the name of this entity.
 JDBCOptimisticLockingMetaData (src) getOptimisticLocking()
          Returns optimistic locking metadata
 java.lang.Class getPrimaryKeyClass()
          Gets the primary key class for this entity
 java.lang.String getPrimaryKeyFieldName()
          Gets the name of the primary key field of this entity or null if the primary key is multivalued
 java.lang.Class getQLCompiler()
           
 java.util.Collection getQueries()
          Gets the queries defined on this entity
 JDBCQueryMetaData (src) getQueryMetaDataForMethod(java.lang.reflect.Method method)
           
 JDBCReadAheadMetaData (src) getReadAhead()
          Gets the read ahead meta data for this entity.
 int getReadTimeOut()
          How long is a read of this entity valid.
 java.util.Collection getRelationshipRoles()
          Get the relationsip roles of this entity.
 java.lang.Class getRemoteClass()
          Gets the remote class of this entity
 boolean getRemoveTable()
          Gets the flag used to determine if the store manager should attempt to remove database table when the entity is undeployed.
 boolean getThrowRuntimeExceptions()
          Gets the throw-runtime-exceptions meta data for this entity.
 JDBCTypeMappingMetaData (src) getTypeMapping()
          Gets the jdbc type mapping for this entity
 int hashCode()
          Returns a hashcode for this JDBCEntityMetaData.
 boolean hasPrimaryKeyConstraint()
          Gets the flag used to determine if the store manager should add a priary key constraint when creating the table
 boolean hasRowLocking()
          Gets the flag used to determine if the store manager should do row locking when loading entity beans
 boolean isCleanReadAheadOnLoad()
           
 boolean isCMP1x()
          Does this entity use CMP version 1.x
 boolean isReadOnly()
          Is this entity read only? A readonly entity will never be stored into the database.
 boolean isThrowRuntimeExceptions()
          Is the throw-runtime-exceptions meta data for this entity is true.
static JDBCTypeMappingMetaData (src) obtainTypeMappingFromLibrary(java.lang.String dataSourceName)
           
 java.lang.String toString()
          Returns a string describing this JDBCEntityMetaData.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JDBCEntityMetaData

public JDBCEntityMetaData(JDBCApplicationMetaData (src)  jdbcApplication,
                          EntityMetaData (src)  entity)
                   throws DeploymentException (src) 
Constructs jdbc entity meta data defined in the jdbcApplication and with the data from the entity meta data which is loaded from the ejb-jar.xml file.

Parameters:
jdbcApplication - the application in which this entity is defined
entity - the entity meta data for this entity that is loaded from the ejb-jar.xml file
Throws:
DeploymentException (src) - if an problem occures while loading the classes or if data in the ejb-jar.xml is inconsistent with data from jbosscmp-jdbc.xml file

JDBCEntityMetaData

public JDBCEntityMetaData(JDBCApplicationMetaData (src)  jdbcApplication,
                          org.w3c.dom.Element element,
                          JDBCEntityMetaData (src)  defaultValues)
                   throws DeploymentException (src) 
Constructs entity meta data with the data contained in the entity xml element from a jbosscmp-jdbc xml file. Optional values of the xml element that are not present are loaded from the defalutValues parameter.

Parameters:
jdbcApplication - the application in which this entity is defined
element - the xml Element which contains the metadata about this entity
defaultValues - the JDBCEntityMetaData which contains the values for optional elements of the element
Throws:
DeploymentException (src) - if the xml element is not semantically correct
Method Detail

getJDBCApplication

public JDBCApplicationMetaData (src)  getJDBCApplication()
Gets the meta data for the application of which this entity is a member.

Returns:
the meta data for the application that this entity is a memeber

getDataSourceName

public java.lang.String getDataSourceName()
Gets the name of the datasource in jndi for this entity

Returns:
the name of datasource in jndi

getTypeMapping

public JDBCTypeMappingMetaData (src)  getTypeMapping()
                                       throws DeploymentException (src) 
Gets the jdbc type mapping for this entity

Returns:
the jdbc type mapping for this entity
Throws:
DeploymentException (src)

getName

public java.lang.String getName()
Gets the name of this entity. The name come from the ejb-jar.xml file.

Returns:
the name of this entity

getAbstractSchemaName

public java.lang.String getAbstractSchemaName()
Gets the abstract shcema name of this entity. The name come from the ejb-jar.xml file.

Returns:
the abstract schema name of this entity

getClassLoader

public java.lang.ClassLoader getClassLoader()
Gets the class loaded which is used to load all classes used by this entity

Returns:
the class loader which is used to load all classes used by this entity

getEntityClass

public java.lang.Class getEntityClass()
Gets the implementation class of this entity

Returns:
the implementation class of this entity

getHomeClass

public java.lang.Class getHomeClass()
Gets the home class of this entity

Returns:
the home class of this entity

getRemoteClass

public java.lang.Class getRemoteClass()
Gets the remote class of this entity

Returns:
the remote class of this entity

getLocalHomeClass

public java.lang.Class getLocalHomeClass()
Gets the local home class of this entity

Returns:
the local home class of this entity

getLocalClass

public java.lang.Class getLocalClass()
Gets the local class of this entity

Returns:
the local class of this entity

isCMP1x

public boolean isCMP1x()
Does this entity use CMP version 1.x

Returns:
true if this entity used CMP version 1.x; otherwise false

getCMPFields

public java.util.List getCMPFields()
Gets the cmp fields of this entity

Returns:
an unmodifiable collection of JDBCCMPFieldMetaData objects

getEagerLoadGroup

public java.lang.String getEagerLoadGroup()
Gets the name of the eager load group. This name can be used to look up the load group.

Returns:
the name of the eager load group

getLazyLoadGroups

public java.util.List getLazyLoadGroups()
Gets the collection of lazy load group names.

Returns:
an unmodifiable collection of load group names

getLoadGroups

public java.util.Map getLoadGroups()
Gets the map from load grou name to a List of field names, which forms a logical load group.

Returns:
an unmodifiable map of load groups (Lists) by group name.

getLoadGroup

public java.util.List getLoadGroup(java.lang.String name)
                            throws DeploymentException (src) 
Gets the load group with the specified name.

Returns:
the load group with the specified name
Throws:
DeploymentException (src) - if group with the specified name is not found

getOptimisticLocking

public JDBCOptimisticLockingMetaData (src)  getOptimisticLocking()
Returns optimistic locking metadata


getAudit

public JDBCAuditMetaData (src)  getAudit()
Returns audit metadata


getCMPFieldByName

public JDBCCMPFieldMetaData (src)  getCMPFieldByName(java.lang.String name)
Gets the cmp field with the specified name

Parameters:
name - the name of the desired field
Returns:
the cmp field with the specified name or null if not found

getDefaultTableName

public java.lang.String getDefaultTableName()
Gets the name of the table to which this entity is persisted

Returns:
the name of the table to which this entity is persisted

getCreateTable

public boolean getCreateTable()
Gets the flag used to determine if the store manager should attempt to create database table when the entity is deployed.

Returns:
true if the store manager should attempt to create the table

getRemoveTable

public boolean getRemoveTable()
Gets the flag used to determine if the store manager should attempt to remove database table when the entity is undeployed.

Returns:
true if the store manager should attempt to remove the table

getAlterTable

public boolean getAlterTable()
Gets the flag used to determine if the store manager should attempt to alter table when the entity is deployed.


getDefaultTablePostCreateCmd

public java.util.ArrayList getDefaultTablePostCreateCmd()
Get the (user-defined) SQL commands that sould be issued after table creation

Returns:
the SQL command to issue to the DB-server

hasPrimaryKeyConstraint

public boolean hasPrimaryKeyConstraint()
Gets the flag used to determine if the store manager should add a priary key constraint when creating the table

Returns:
true if the store manager should add a primary key constraint to the create table sql statement

hasRowLocking

public boolean hasRowLocking()
Gets the flag used to determine if the store manager should do row locking when loading entity beans

Returns:
true if the store manager should add a row locking clause when selecting data from the table

getListCacheMax

public int getListCacheMax()
The maximum number of qurey result lists that will be tracked.


getFetchSize

public int getFetchSize()
The number of rows that the database driver should get in a single trip to the database.


getQueries

public java.util.Collection getQueries()
Gets the queries defined on this entity

Returns:
an unmodifiable collection of JDBCQueryMetaData objects

getQueryMetaDataForMethod

public JDBCQueryMetaData (src)  getQueryMetaDataForMethod(java.lang.reflect.Method method)
Parameters:
method - finder method name.
Returns:
corresponding query metadata or null.

getRelationshipRoles

public java.util.Collection getRelationshipRoles()
Get the relationsip roles of this entity. Items are instance of JDBCRelationshipRoleMetaData.

Returns:
an unmodifiable collection of the relationship roles defined for this entity

getPrimaryKeyClass

public java.lang.Class getPrimaryKeyClass()
Gets the primary key class for this entity

Returns:
the primary key class for this entity

getEntityCommand

public JDBCEntityCommandMetaData (src)  getEntityCommand()
Gets the entity command metadata

Returns:
the entity command metadata

isReadOnly

public boolean isReadOnly()
Is this entity read only? A readonly entity will never be stored into the database.

Returns:
true if this entity is read only

getReadTimeOut

public int getReadTimeOut()
How long is a read of this entity valid. This property should only be used on read only entities, and determines how long the data read from the database is valid. When the read times out it should be reread from the database. If the value is -1 and the entity is not using commit option a, the read is only valid for the length of the transaction in which it was loaded.

Returns:
the length of time that a read is valid or -1 if the read is only valid for the length of the transaction

getPrimaryKeyFieldName

public java.lang.String getPrimaryKeyFieldName()
Gets the name of the primary key field of this entity or null if the primary key is multivalued

Returns:
the name of the primary key field of this entity or null if the primary key is multivalued

getReadAhead

public JDBCReadAheadMetaData (src)  getReadAhead()
Gets the read ahead meta data for this entity.

Returns:
the read ahead meta data for this entity.

getQLCompiler

public java.lang.Class getQLCompiler()

isThrowRuntimeExceptions

public boolean isThrowRuntimeExceptions()
Is the throw-runtime-exceptions meta data for this entity is true.

Returns:
the throw-runtime-exceptions meta data for this entity.

getThrowRuntimeExceptions

public boolean getThrowRuntimeExceptions()
Gets the throw-runtime-exceptions meta data for this entity.

Returns:
the throw-runtime-exceptions meta data for this entity.

isCleanReadAheadOnLoad

public boolean isCleanReadAheadOnLoad()

obtainTypeMappingFromLibrary

public static JDBCTypeMappingMetaData (src)  obtainTypeMappingFromLibrary(java.lang.String dataSourceName)
                                                            throws DeploymentException (src) 
Throws:
DeploymentException (src)

equals

public boolean equals(java.lang.Object o)
Compares this JDBCEntityMetaData against the specified object. Returns true if the objects are the same. Two JDBCEntityMetaData are the same if they both have the same name and are defined in the same application.

Parameters:
o - the reference object with which to compare
Returns:
true if this object is the same as the object argument; false otherwise

hashCode

public int hashCode()
Returns a hashcode for this JDBCEntityMetaData. The hashcode is computed based on the hashCode of the declaring application and the hashCode of the entityName

Returns:
a hash code value for this object

toString

public java.lang.String toString()
Returns a string describing this JDBCEntityMetaData. The exact details of the representation are unspecified and subject to change, but the following may be regarded as typical:

"[JDBCEntityMetaData: entityName=UserEJB]"

Returns:
a string representation of the object