org.hibernate.metadata
Interface ClassMetadata

All Known Implementing Classes:
AbstractEntityPersister, JoinedSubclassEntityPersister, SingleTableEntityPersister, UnionSubclassEntityPersister

public interface ClassMetadata

Exposes entity class metadata to the application

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

Method Summary
 String getEntityName()
          The name of the entity
 Serializable getIdentifier(Object entity, EntityMode entityMode)
          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(EntityMode entityMode)
          The persistent class, or null
 int[] getNaturalIdentifierProperties()
          Which properties hold the natural id?
 boolean[] getPropertyLaziness()
          Get the "laziness" of the properties of this 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, EntityMode entityMode)
          Get the value of a particular (named) property
 Object[] getPropertyValues(Object entity, EntityMode entityMode)
          Extract the property values from the given entity.
 Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session)
          Return the values of the mapped properties of the object
 Object getVersion(Object object, EntityMode entityMode)
          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 hasNaturalIdentifier()
          Does this entity declare a natural id?
 boolean hasProxy()
          Does this class support dynamic proxies?
 boolean hasSubclasses()
          Does this entity have mapped subclasses?
 boolean implementsLifecycle(EntityMode entityMode)
          Does the class implement the Lifecycle interface?
 boolean implementsValidatable(EntityMode entityMode)
          Does the class implement the Validatable interface?
 Object instantiate(Serializable id, EntityMode entityMode)
          Create a class instance initialized with the given identifier
 boolean isInherited()
          Does this entity extend a mapped superclass?
 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, EntityMode entityMode)
          Set the identifier of an instance (or do nothing if no identifier property)
 void setPropertyValue(Object object, String propertyName, Object value, EntityMode entityMode)
          Set the value of a particular (named) property
 void setPropertyValues(Object object, Object[] values, EntityMode entityMode)
          Set the given values to the mapped properties of the given object
 

Method Detail

getEntityName

String getEntityName()
The name of the entity


getIdentifierPropertyName

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


getPropertyNames

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


getIdentifierType

Type getIdentifierType()
Get the identifier Hibernate type


getPropertyTypes

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


getPropertyType

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

Throws:
HibernateException

hasProxy

boolean hasProxy()
Does this class support dynamic proxies?


isMutable

boolean isMutable()
Are instances of this class mutable?


isVersioned

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


getVersionProperty

int getVersionProperty()
Get the index of the version property


getPropertyNullability

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


getPropertyLaziness

boolean[] getPropertyLaziness()
Get the "laziness" of the properties of this class


hasIdentifierProperty

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


hasNaturalIdentifier

boolean hasNaturalIdentifier()
Does this entity declare a natural id?


getNaturalIdentifierProperties

int[] getNaturalIdentifierProperties()
Which properties hold the natural id?


hasSubclasses

boolean hasSubclasses()
Does this entity have mapped subclasses?


isInherited

boolean isInherited()
Does this entity extend a mapped superclass?


getPropertyValuesToInsert

Object[] getPropertyValuesToInsert(Object entity,
                                   Map mergeMap,
                                   SessionImplementor session)
                                   throws HibernateException
Return the values of the mapped properties of the object

Throws:
HibernateException

getMappedClass

Class getMappedClass(EntityMode entityMode)
The persistent class, or null


instantiate

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

Throws:
HibernateException

getPropertyValue

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

Throws:
HibernateException

getPropertyValues

Object[] getPropertyValues(Object entity,
                           EntityMode entityMode)
                           throws HibernateException
Extract the property values from the given entity.

Parameters:
entity - The entity from which to extract the property values.
entityMode - The entity-mode of the given entity
Returns:
The property values.
Throws:
HibernateException

setPropertyValue

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

Throws:
HibernateException

setPropertyValues

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

Throws:
HibernateException

getIdentifier

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

Throws:
HibernateException

setIdentifier

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

Throws:
HibernateException

implementsLifecycle

boolean implementsLifecycle(EntityMode entityMode)
Does the class implement the Lifecycle interface?


implementsValidatable

boolean implementsValidatable(EntityMode entityMode)
Does the class implement the Validatable interface?


getVersion

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

Throws:
HibernateException