Top Description Methods
org.hibernate.metadata

public Interface ClassMetadata

Known Direct Implementers
org.hibernate.persister.entity.AbstractEntityPersister
Imports
java.io.Serializable, java.util.Map, org.hibernate.HibernateException, .EntityMode, org.hibernate.engine.SessionImplementor, org.hibernate.type.Type

Exposes entity class metadata to the application
Author
Gavin King
See Also
org.hibernate.SessionFactory#getClassMetadata(Class)

Method Summary

Modifier and TypeMethod and Description
public String
getEntityName()

The name of the entity

public Serializable
getIdentifier(Object object, EntityMode entityMode)

Get the identifier of an instance (throw an exception if no identifier property)
public Serializable

Returns:

The identifier
getIdentifier
(Object
The entity for which to get the identifier
entity
,
SessionImplementor
The session from which the request originated
session
)

Get the identifier of an instance (throw an exception if no identifier property)

public String
getIdentifierPropertyName()

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

public Type
getIdentifierType()

Get the identifier Hibernate type

public Class<T>
getMappedClass(EntityMode entityMode)

The persistent class, or null

public int[]
getNaturalIdentifierProperties()

Which properties hold the natural id?

public boolean[]
getPropertyLaziness()

Get the "laziness" of the properties of this class

public String[]
getPropertyNames()

Get the names of the class' persistent properties

public boolean[]
getPropertyNullability()

Get the nullability of the class' persistent properties

public Type
getPropertyType(String propertyName)

Get the type of a particular (named) property

public Type[]
getPropertyTypes()

Get the Hibernate types of the class properties

public Object
getPropertyValue(Object object, String propertyName, EntityMode entityMode)

Get the value of a particular (named) property

public Object[]

Returns:

The property values.
getPropertyValues
(Object
The entity from which to extract the property values.
entity
,
EntityMode
The entity-mode of the given entity
entityMode
)

Extract the property values from the given entity.

public Object[]
getPropertyValuesToInsert(Object entity, Map<K, V> mergeMap, SessionImplementor session)

Return the values of the mapped properties of the object

public Object
getVersion(Object object, EntityMode entityMode)

Get the version number (or timestamp) from the object's version property (or return null if not versioned)

public int
getVersionProperty()

Get the index of the version property

public boolean
hasIdentifierProperty()

Does this class have an identifier property?

public boolean
hasNaturalIdentifier()

Does this entity declare a natural id?

public boolean
hasProxy()

Does this class support dynamic proxies?

public boolean
hasSubclasses()

Does this entity have mapped subclasses?

public boolean
implementsLifecycle(EntityMode entityMode)

Does the class implement the Lifecycle interface?

public boolean
implementsValidatable(EntityMode entityMode)

Does the class implement the Validatable interface?

public Object
instantiate(Serializable id, EntityMode entityMode)

Create a class instance initialized with the given identifier
public Object

Returns:

The instantiated entity.
instantiate
(Serializable
The identifier value to use (may be null to represent no value)
id
,
SessionImplementor
The session from which the request originated.
session
)

Create a class instance initialized with the given identifier

public boolean
isInherited()

Does this entity extend a mapped superclass?

public boolean
isMutable()

Are instances of this class mutable?

public boolean
isVersioned()

Are instances of this class versioned by a timestamp or version number column?

public void
setIdentifier(Object
The entity to inject with the identifier value.
entity
,
Serializable
The value to be injected as the identifier.
id
,
EntityMode
The entity mode
entityMode
)

Inject the identifier value into the given entity.
public void
setIdentifier(Object
The entity to inject with the identifier value.
entity
,
Serializable
The value to be injected as the identifier.
id
,
SessionImplementor
The session from which is requests originates
session
)

Inject the identifier value into the given entity.

public void
setPropertyValue(Object object, String propertyName, Object value, EntityMode entityMode)

Set the value of a particular (named) property

public void
setPropertyValues(Object object, Object[] values, EntityMode entityMode)

Set the given values to the mapped properties of the given object

Method Detail

getEntityNameback to summary
public String getEntityName()

The name of the entity

getIdentifierback to summary
public Serializable getIdentifier(Object object, EntityMode entityMode) throws HibernateException

Get the identifier of an instance (throw an exception if no identifier property)

getIdentifierback to summary
public Serializable getIdentifier(Object entity, SessionImplementor session)

Get the identifier of an instance (throw an exception if no identifier property)

Parameters
entity:Object

The entity for which to get the identifier

session:SessionImplementor

The session from which the request originated

Returns:Serializable

The identifier

getIdentifierPropertyNameback to summary
public String getIdentifierPropertyName()

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

getIdentifierTypeback to summary
public Type getIdentifierType()

Get the identifier Hibernate type

getMappedClassback to summary
public Class<T> getMappedClass(EntityMode entityMode)

The persistent class, or null

getNaturalIdentifierPropertiesback to summary
public int[] getNaturalIdentifierProperties()

Which properties hold the natural id?

getPropertyLazinessback to summary
public boolean[] getPropertyLaziness()

Get the "laziness" of the properties of this class

getPropertyNamesback to summary
public String[] getPropertyNames()

Get the names of the class' persistent properties

getPropertyNullabilityback to summary
public boolean[] getPropertyNullability()

Get the nullability of the class' persistent properties

getPropertyTypeback to summary
public Type getPropertyType(String propertyName) throws HibernateException

Get the type of a particular (named) property

getPropertyTypesback to summary
public Type[] getPropertyTypes()

Get the Hibernate types of the class properties

getPropertyValueback to summary
public Object getPropertyValue(Object object, String propertyName, EntityMode entityMode) throws HibernateException

Get the value of a particular (named) property

getPropertyValuesback to summary
public Object[] getPropertyValues(Object entity, EntityMode entityMode) throws HibernateException

Extract the property values from the given entity.

Parameters
entity:Object

The entity from which to extract the property values.

entityMode:EntityMode

The entity-mode of the given entity

Returns:Object[]

The property values.

getPropertyValuesToInsertback to summary
public Object[] getPropertyValuesToInsert(Object entity, Map<K, V> mergeMap, SessionImplementor session) throws HibernateException

Return the values of the mapped properties of the object

getVersionback to summary
public 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)

getVersionPropertyback to summary
public int getVersionProperty()

Get the index of the version property

hasIdentifierPropertyback to summary
public boolean hasIdentifierProperty()

Does this class have an identifier property?

hasNaturalIdentifierback to summary
public boolean hasNaturalIdentifier()

Does this entity declare a natural id?

hasProxyback to summary
public boolean hasProxy()

Does this class support dynamic proxies?

hasSubclassesback to summary
public boolean hasSubclasses()

Does this entity have mapped subclasses?

implementsLifecycleback to summary
public boolean implementsLifecycle(EntityMode entityMode)

Does the class implement the Lifecycle interface?

implementsValidatableback to summary
public boolean implementsValidatable(EntityMode entityMode)

Does the class implement the Validatable interface?

instantiateback to summary
public Object instantiate(Serializable id, EntityMode entityMode) throws HibernateException

Create a class instance initialized with the given identifier

instantiateback to summary
public Object instantiate(Serializable id, SessionImplementor session)

Create a class instance initialized with the given identifier

Parameters
id:Serializable

The identifier value to use (may be null to represent no value)

session:SessionImplementor

The session from which the request originated.

Returns:Object

The instantiated entity.

isInheritedback to summary
public boolean isInherited()

Does this entity extend a mapped superclass?

isMutableback to summary
public boolean isMutable()

Are instances of this class mutable?

isVersionedback to summary
public boolean isVersioned()

Are instances of this class versioned by a timestamp or version number column?

setIdentifierback to summary
public void setIdentifier(Object entity, Serializable id, EntityMode entityMode) throws HibernateException

Inject the identifier value into the given entity.

Has no effect if the entity does not define an identifier property
Parameters
entity:Object

The entity to inject with the identifier value.

id:Serializable

The value to be injected as the identifier.

entityMode:EntityMode

The entity mode

setIdentifierback to summary
public void setIdentifier(Object entity, Serializable id, SessionImplementor session)

Inject the identifier value into the given entity.

Parameters
entity:Object

The entity to inject with the identifier value.

id:Serializable

The value to be injected as the identifier.

session:SessionImplementor

The session from which is requests originates

setPropertyValueback to summary
public void setPropertyValue(Object object, String propertyName, Object value, EntityMode entityMode) throws HibernateException

Set the value of a particular (named) property

setPropertyValuesback to summary
public void setPropertyValues(Object object, Object[] values, EntityMode entityMode) throws HibernateException

Set the given values to the mapped properties of the given object