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

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


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

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

public final class JDBCCMPFieldMetaData
extends Object

Imutable class which holds all the information jbosscmp-jdbc needs to know about a CMP field It loads its data from standardjbosscmp-jdbc.xml and jbosscmp-jdbc.xml

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

Field Summary
static byte CHECK_DIRTY_AFTER_GET_FALSE
           
static byte CHECK_DIRTY_AFTER_GET_NOT_PRESENT
           
static byte CHECK_DIRTY_AFTER_GET_TRUE
           
 
Constructor Summary
JDBCCMPFieldMetaData(JDBCEntityMetaData entity)
          This constructor is added especially for unknown primary key field
JDBCCMPFieldMetaData(JDBCEntityMetaData entity, Element element, JDBCCMPFieldMetaData defaultValues)
          Constructs cmp field meta data with the data contained in the cmp-field xml element from a jbosscmp-jdbc xml file.
JDBCCMPFieldMetaData(JDBCEntityMetaData entity, Element element, JDBCCMPFieldMetaData defaultValues, boolean primaryKeyMember, boolean notNull, boolean readOnly, int readTimeOut, boolean relationTableField)
          Constructs cmp field meta data with the data contained in the cmp-field xml element from a jbosscmp-jdbc xml file.
JDBCCMPFieldMetaData(JDBCEntityMetaData entity, JDBCCMPFieldMetaData defaultValues)
           
JDBCCMPFieldMetaData(JDBCEntityMetaData entity, JDBCCMPFieldMetaData defaultValues, String columnName, boolean primaryKeyMember, boolean notNull, boolean readOnly, int readTimeOut, boolean relationTableField)
          Constructs a foreign key or a relation table key field.
JDBCCMPFieldMetaData(JDBCEntityMetaData entity, String fieldName)
          Constructs cmp field meta data for a field on the specified entity with the specified fieldName.
JDBCCMPFieldMetaData(JDBCEntityMetaData entity, String fieldName, Class fieldType, String columnName, int jdbcType, String sqlType)
          Constructs a field that is used as an optimistic lock
 
Method Summary
 boolean equals(Object o)
          Compares this JDBCCMPFieldMetaData against the specified object.
 byte getCheckDirtyAfterGet()
           
 String getColumnName()
          Gets the column name the property should use or null if the column name is not overriden.
 JDBCEntityMetaData getEntity()
          Gets the entity on which this field is defined
 String getFieldName()
          Gets the name of the field.
 Class getFieldType()
          Gets the java Class type of this field.
 int getJDBCType()
          Gets the JDBC type the property should use or Integer.MIN_VALUE if not overriden.
 Field getPrimaryKeyField()
          Gets the Field of the primary key object which contains the value of this field.
 List getPropertyOverrides()
          Gets the property overrides.
 int getReadTimeOut()
          Gets the length of time (ms) that a read valid or -1 if data must always be reread from the database
 String getSQLType()
          Gets the SQL type the property should use or null if not overriden.
 String getStateFactory()
           
 int hashCode()
          Returns a hashcode for this JDBCCMPFieldMetaData.
 boolean isAutoIncrement()
           
 boolean isIndexed()
          Should an index for this field be generated? Normally this should be false for primary key fields But it seems there are databases that do not automatically put indices on primary keys *sigh*
 boolean isNotNull()
          Should this field allow null values?
 boolean isPrimaryKeyMember()
          Is this field one of the primary key fields?
 boolean isReadOnly()
          Is this field read only.
 boolean isRelationTableField()
           
 boolean isUnknownPkField()
          Is this field an unknown primary key field?
static byte readCheckDirtyAfterGet(Element element)
           
 String toString()
          Returns a string describing this JDBCCMPFieldMetaData.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CHECK_DIRTY_AFTER_GET_TRUE

public static final byte CHECK_DIRTY_AFTER_GET_TRUE
See Also:
Constant Field Values

CHECK_DIRTY_AFTER_GET_FALSE

public static final byte CHECK_DIRTY_AFTER_GET_FALSE
See Also:
Constant Field Values

CHECK_DIRTY_AFTER_GET_NOT_PRESENT

public static final byte CHECK_DIRTY_AFTER_GET_NOT_PRESENT
See Also:
Constant Field Values
Constructor Detail

JDBCCMPFieldMetaData

public JDBCCMPFieldMetaData(JDBCEntityMetaData entity)
This constructor is added especially for unknown primary key field


JDBCCMPFieldMetaData

public JDBCCMPFieldMetaData(JDBCEntityMetaData entity,
                            String fieldName)
                     throws org.jboss.deployment.DeploymentException
Constructs cmp field meta data for a field on the specified entity with the specified fieldName.

Parameters:
fieldName - name of the field for which the meta data will be loaded
entity - entity on which this field is defined
Throws:
org.jboss.deployment.DeploymentException - if data in the entity is inconsistent with field type

JDBCCMPFieldMetaData

public JDBCCMPFieldMetaData(JDBCEntityMetaData entity,
                            JDBCCMPFieldMetaData defaultValues)

JDBCCMPFieldMetaData

public JDBCCMPFieldMetaData(JDBCEntityMetaData entity,
                            Element element,
                            JDBCCMPFieldMetaData defaultValues)
                     throws org.jboss.deployment.DeploymentException
Constructs cmp field meta data with the data contained in the cmp-field xml element from a jbosscmp-jdbc xml file. Optional values of the xml element that are not present are instead loaded from the defalutValues parameter.

Parameters:
element - the xml Element which contains the metadata about this field
defaultValues - the JDBCCMPFieldMetaData which contains the values for optional elements of the element
Throws:
org.jboss.deployment.DeploymentException - if the xml element is not semantically correct

JDBCCMPFieldMetaData

public JDBCCMPFieldMetaData(JDBCEntityMetaData entity,
                            Element element,
                            JDBCCMPFieldMetaData defaultValues,
                            boolean primaryKeyMember,
                            boolean notNull,
                            boolean readOnly,
                            int readTimeOut,
                            boolean relationTableField)
                     throws org.jboss.deployment.DeploymentException
Constructs cmp field meta data with the data contained in the cmp-field xml element from a jbosscmp-jdbc xml file. Optional values of the xml element that are not present are instead loaded from the defalutValues parameter. This constructor form is used to create cmp field meta data for use as foreign keys. The primaryKeyMember parameter is very important in this context because a foreign key is not a primary key member but used a pk member as the default value. If we did not have the primary key member parameter this JDBCCMPFieldMetaData would get the value from the defaultValues and be declared a memeber.


JDBCCMPFieldMetaData

public JDBCCMPFieldMetaData(JDBCEntityMetaData entity,
                            JDBCCMPFieldMetaData defaultValues,
                            String columnName,
                            boolean primaryKeyMember,
                            boolean notNull,
                            boolean readOnly,
                            int readTimeOut,
                            boolean relationTableField)
Constructs a foreign key or a relation table key field.


JDBCCMPFieldMetaData

public JDBCCMPFieldMetaData(JDBCEntityMetaData entity,
                            String fieldName,
                            Class fieldType,
                            String columnName,
                            int jdbcType,
                            String sqlType)
                     throws org.jboss.deployment.DeploymentException
Constructs a field that is used as an optimistic lock

Method Detail

readCheckDirtyAfterGet

public static byte readCheckDirtyAfterGet(Element element)
                                   throws org.jboss.deployment.DeploymentException
Throws:
org.jboss.deployment.DeploymentException

getEntity

public JDBCEntityMetaData getEntity()
Gets the entity on which this field is defined

Returns:
the entity on which this field is defined

getFieldName

public String getFieldName()
Gets the name of the field.

Returns:
the name of this field

getFieldType

public Class getFieldType()
Gets the java Class type of this field.

Returns:
the Class type of this field

getColumnName

public String getColumnName()
Gets the column name the property should use or null if the column name is not overriden.

Returns:
the name to which this field is persisted or null if the column name is not overriden

getJDBCType

public int getJDBCType()
Gets the JDBC type the property should use or Integer.MIN_VALUE if not overriden.

Returns:
the jdbc type of this field

getSQLType

public String getSQLType()
Gets the SQL type the property should use or null if not overriden.

Returns:
the sql data type string used in create table statements

getPropertyOverrides

public List getPropertyOverrides()
Gets the property overrides. Property overrides change the default mapping of Dependent Value Object properties. If there are no property overrides this method returns an empty list.

Returns:
an unmodifiable list of the property overrides.

isReadOnly

public boolean isReadOnly()
Is this field read only. A read only field will never be persisted

Returns:
true if this field is read only

getReadTimeOut

public int getReadTimeOut()
Gets the length of time (ms) that a read valid or -1 if data must always be reread from the database

Returns:
the length of time that data read database is valid, or -1 if data must always be reread from the database

isPrimaryKeyMember

public boolean isPrimaryKeyMember()
Is this field one of the primary key fields?

Returns:
true if this field is one of the primary key fields

isNotNull

public boolean isNotNull()
Should this field allow null values?

Returns:
true if this field will not allow a null value.

isIndexed

public boolean isIndexed()
Should an index for this field be generated? Normally this should be false for primary key fields But it seems there are databases that do not automatically put indices on primary keys *sigh*

Returns:
true if an index should be generated on this field

getPrimaryKeyField

public Field getPrimaryKeyField()
Gets the Field of the primary key object which contains the value of this field. Returns null, if this field is not a member of the primary key, or if the primray key is single valued.

Returns:
the Field of the primary key which contains the value of this field

isUnknownPkField

public boolean isUnknownPkField()
Is this field an unknown primary key field?

Returns:
true if the field is an unknown primary key field

isAutoIncrement

public boolean isAutoIncrement()
Returns:
true if the key is auto incremented by the database

isRelationTableField

public boolean isRelationTableField()

getCheckDirtyAfterGet

public byte getCheckDirtyAfterGet()

getStateFactory

public String getStateFactory()

equals

public boolean equals(Object o)
Compares this JDBCCMPFieldMetaData against the specified object. Returns true if the objects are the same. Two JDBCCMPFieldMetaData are the same if they both have the same name and are defined on the same entity.

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 JDBCCMPFieldMetaData. The hashcode is computed based on the hashCode of the declaring entity and the hashCode of the fieldName

Returns:
a hash code value for this object

toString

public String toString()
Returns a string describing this JDBCCMPFieldMetaData. The exact details of the representation are unspecified and subject to change, but the following may be regarded as typical: "[JDBCCMPFieldMetaData: fieldName=name, [JDBCEntityMetaData: entityName=UserEJB]]"

Returns:
a string representation of the object


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