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

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

public final class JDBCEntityMetaData
extends Object

This immutable class contains information about an entity

Version:
$Revision: 57209 $
Author:
Dain Sundstrom, Sebastien Alborini, Dirk Zimmermann, Alex Loubyansky, Heiko W. Rupp

Constructor Summary
JDBCEntityMetaData(JDBCApplicationMetaData jdbcApplication, Element element, JDBCEntityMetaData defaultValues)
          Constructs entity meta data with the data contained in the entity xml element from a jbosscmp-jdbc xml file.
JDBCEntityMetaData(JDBCApplicationMetaData jdbcApplication, EntityMetaData 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(Object o)
          Compares this JDBCEntityMetaData against the specified object.
 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 getAudit()
          Returns audit metadata
 ClassLoader getClassLoader()
          Gets the class loaded which is used to load all classes used by this entity
 JDBCCMPFieldMetaData getCMPFieldByName(String name)
          Gets the cmp field with the specified name
 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.
 String getDataSourceName()
          Gets the name of the datasource in jndi for this entity
 String getDefaultTableName()
          Gets the name of the table to which this entity is persisted
 ArrayList getDefaultTablePostCreateCmd()
          Get the (user-defined) SQL commands that sould be issued after table creation
 String getEagerLoadGroup()
          Gets the name of the eager load group.
 Class getEntityClass()
          Gets the implementation class of this entity
 JDBCEntityCommandMetaData 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.
 Class getHomeClass()
          Gets the home class of this entity
 JDBCApplicationMetaData getJDBCApplication()
          Gets the meta data for the application of which this entity is a member.
 List getLazyLoadGroups()
          Gets the collection of lazy load group names.
 int getListCacheMax()
          The maximum number of qurey result lists that will be tracked.
 List getLoadGroup(String name)
          Gets the load group with the specified name.
 Map getLoadGroups()
          Gets the map from load grou name to a List of field names, which forms a logical load group.
 Class getLocalClass()
          Gets the local class of this entity
 Class getLocalHomeClass()
          Gets the local home class of this entity
 String getName()
          Gets the name of this entity.
 JDBCOptimisticLockingMetaData getOptimisticLocking()
          Returns optimistic locking metadata
 Class getPrimaryKeyClass()
          Gets the primary key class for this entity
 String getPrimaryKeyFieldName()
          Gets the name of the primary key field of this entity or null if the primary key is multivalued
 Class getQLCompiler()
           
 Collection getQueries()
          Gets the queries defined on this entity
 JDBCQueryMetaData getQueryMetaDataForMethod(Method method)
           
 JDBCReadAheadMetaData getReadAhead()
          Gets the read ahead meta data for this entity.
 int getReadTimeOut()
          How long is a read of this entity valid.
 Collection getRelationshipRoles()
          Get the relationsip roles of this entity.
 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 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 obtainTypeMappingFromLibrary(String dataSourceName)
           
 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 jdbcApplication,
                          EntityMetaData entity)
                   throws org.jboss.deployment.DeploymentException
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:
org.jboss.deployment.DeploymentException - 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 jdbcApplication,
                          Element element,
                          JDBCEntityMetaData defaultValues)
                   throws org.jboss.deployment.DeploymentException
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:
org.jboss.deployment.DeploymentException - if the xml element is not semantically correct
Method Detail

getJDBCApplication

public JDBCApplicationMetaData 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 String getDataSourceName()
Gets the name of the datasource in jndi for this entity

Returns:
the name of datasource in jndi

getTypeMapping

public JDBCTypeMappingMetaData getTypeMapping()
                                       throws org.jboss.deployment.DeploymentException
Gets the jdbc type mapping for this entity

Returns:
the jdbc type mapping for this entity
Throws:
org.jboss.deployment.DeploymentException

getName

public 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 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 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 Class getEntityClass()
Gets the implementation class of this entity

Returns:
the implementation class of this entity

getHomeClass

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

Returns:
the home class of this entity

getRemoteClass

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

Returns:
the remote class of this entity

getLocalHomeClass

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

Returns:
the local home class of this entity

getLocalClass

public 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 List getCMPFields()
Gets the cmp fields of this entity

Returns:
an unmodifiable collection of JDBCCMPFieldMetaData objects

getEagerLoadGroup

public 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 List getLazyLoadGroups()
Gets the collection of lazy load group names.

Returns:
an unmodifiable collection of load group names

getLoadGroups

public 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 List getLoadGroup(String name)
                  throws org.jboss.deployment.DeploymentException
Gets the load group with the specified name.

Returns:
the load group with the specified name
Throws:
org.jboss.deployment.DeploymentException - if group with the specified name is not found

getOptimisticLocking

public JDBCOptimisticLockingMetaData getOptimisticLocking()
Returns optimistic locking metadata


getAudit

public JDBCAuditMetaData getAudit()
Returns audit metadata


getCMPFieldByName

public JDBCCMPFieldMetaData getCMPFieldByName(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 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 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 Collection getQueries()
Gets the queries defined on this entity

Returns:
an unmodifiable collection of JDBCQueryMetaData objects

getQueryMetaDataForMethod

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

getRelationshipRoles

public 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 Class getPrimaryKeyClass()
Gets the primary key class for this entity

Returns:
the primary key class for this entity

getEntityCommand

public JDBCEntityCommandMetaData 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 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 getReadAhead()
Gets the read ahead meta data for this entity.

Returns:
the read ahead meta data for this entity.

getQLCompiler

public 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 obtainTypeMappingFromLibrary(String dataSourceName)
                                                            throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException

equals

public boolean equals(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.

Overrides:
equals in class Object
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

Overrides:
hashCode in class Object
Returns:
a hash code value for this object

toString

public 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]"

Overrides:
toString in class Object
Returns:
a string representation of the object


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