站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 2.1.8 正式版 API 英文文档

ClassMetadata (Hibernate API Documentation) - Hibernate 2.1.8 正式版 API 英文文档


net.sf.hibernate.metadata
Interface ClassMetadata

All Known Implementing Classes:
AbstractEntityPersister

public interface ClassMetadata

Exposes entity class metadata to the application

Author:
Gavin King
See Also:
SessionFactory.getClassMetadata(Class)

Method Summary
 Serializable getIdentifier(Object entity)
          Get the identifier of an instance (throw an exception if no identifier property)
 String getIdentifierPropertyName()
          Get the name of the identifier property (or return null)
 Type getIdentifierType()
          Get the identifier Hibernate type
 Class getMappedClass()
          The persistent class
 String[] getPropertyNames()
          Get the names of the class' persistent properties
 boolean[] getPropertyNullability()
          Get the nullability of the class' persistent properties
 Type getPropertyType(String propertyName)
          Get the type of a particular (named) property
 Type[] getPropertyTypes()
          Get the Hibernate types of the class properties
 Object getPropertyValue(Object object, String propertyName)
          Get the value of a particular (named) property
 Object[] getPropertyValues(Object entity)
          Return the values of the mapped properties of the object
 Object getVersion(Object object)
          Get the version number (or timestamp) from the object's version property (or return null if not versioned)
 int getVersionProperty()
          Get the index of the version property
 boolean hasIdentifierProperty()
          Does this class have an identifier property?
 boolean hasProxy()
          Does this class support dynamic proxies?
 boolean implementsLifecycle()
          Does the class implement the Lifecycle interface?
 boolean implementsValidatable()
          Does the class implement the Validatable interface?
 Object instantiate(Serializable id)
          Create a class instance initialized with the given identifier
 boolean isMutable()
          Are instances of this class mutable?
 boolean isVersioned()
          Are instances of this class versioned by a timestamp or version number column?
 void setIdentifier(Object object, Serializable id)
          Set the identifier of an instance (or do nothing if no identifier property)
 void setPropertyValue(Object object, String propertyName, Object value)
          Set the value of a particular (named) property
 void setPropertyValues(Object object, Object[] values)
          Set the given values to the mapped properties of the given object
 

Method Detail

getMappedClass

public Class getMappedClass()
The persistent class


instantiate

public Object instantiate(Serializable id)
                   throws HibernateException
Create a class instance initialized with the given identifier

Throws:
HibernateException

getIdentifierPropertyName

public String getIdentifierPropertyName()
Get the name of the identifier property (or return null)


getPropertyNames

public String[] getPropertyNames()
Get the names of the class' persistent properties


getIdentifierType

public Type getIdentifierType()
Get the identifier Hibernate type


getPropertyTypes

public Type[] getPropertyTypes()
Get the Hibernate types of the class properties


getPropertyType

public Type getPropertyType(String propertyName)
                     throws HibernateException
Get the type of a particular (named) property

Throws:
HibernateException

getPropertyValue

public Object getPropertyValue(Object object,
                               String propertyName)
                        throws HibernateException
Get the value of a particular (named) property

Throws:
HibernateException

setPropertyValue

public void setPropertyValue(Object object,
                             String propertyName,
                             Object value)
                      throws HibernateException
Set the value of a particular (named) property

Throws:
HibernateException

getPropertyValues

public Object[] getPropertyValues(Object entity)
                           throws HibernateException
Return the values of the mapped properties of the object

Throws:
HibernateException

setPropertyValues

public void setPropertyValues(Object object,
                              Object[] values)
                       throws HibernateException
Set the given values to the mapped properties of the given object

Throws:
HibernateException

getIdentifier

public Serializable getIdentifier(Object entity)
                           throws HibernateException
Get the identifier of an instance (throw an exception if no identifier property)

Throws:
HibernateException

setIdentifier

public void setIdentifier(Object object,
                          Serializable id)
                   throws HibernateException
Set the identifier of an instance (or do nothing if no identifier property)

Throws:
HibernateException

implementsLifecycle

public boolean implementsLifecycle()
Does the class implement the Lifecycle interface?


implementsValidatable

public boolean implementsValidatable()
Does the class implement the Validatable interface?


hasProxy

public boolean hasProxy()
Does this class support dynamic proxies?


isMutable

public boolean isMutable()
Are instances of this class mutable?


isVersioned

public boolean isVersioned()
Are instances of this class versioned by a timestamp or version number column?


getVersion

public Object getVersion(Object object)
                  throws HibernateException
Get the version number (or timestamp) from the object's version property (or return null if not versioned)

Throws:
HibernateException

getVersionProperty

public int getVersionProperty()
Get the index of the version property


getPropertyNullability

public boolean[] getPropertyNullability()
Get the nullability of the class' persistent properties


hasIdentifierProperty

public boolean hasIdentifierProperty()
Does this class have an identifier property?