Tag Usage, Class Level (@hibernate)

Tags for declaration of Hibernate descriptor file

@hibernate.class (0..1)

Used to generate descriptor file for Hibernate

Parameter Type Applicability Description Mandatory
jcs-cache text Caching option false
table text The name of its database table. true
discriminator-value text A value that distiguishes individual subclasses, used for polymorphic behaviour. false
mutable text Specifies that instances of the class are (not) mutable. false
schema text Override the schema name specified by the root hibernate-mapping element. false
proxy text Specifies an interface to use for proxies (JDK 1.3+ only) and lazy loading. false

@hibernate.discriminator (0..1)

Defines a discriminator

Parameter Type Applicability Description Mandatory
column text defaults to the property name. The name of the mapped database table column. false
type text A name that indicates the Hibernate type. false
length text The length of the mapped database table column. false

@hibernate.subclass (0..1)

Declare the current class as subclass

Parameter Type Applicability Description Mandatory
discriminator-value text A value that distiguishes individual subclasses, used for polymorphic behaviour. false
proxy text Specifies an interface to use for proxies (JDK 1.3+ only) and lazy loading. false

Tag Usage, Method Level (@hibernate)

Tags for declaration of Hibernate descriptor file

@hibernate.property (0..1)

Defines a property

Parameter Type Applicability Description Mandatory
column text defaults to the property name. The name of the mapped database table column. false
type text A name that indicates the Hibernate type. false
length text The length of the mapped database table column. false
not-null bool If the column is not nullable. false
unique bool If the column is unique. false

@hibernate.component (0..1)

Declares a component

Parameter Type Applicability Description Mandatory
class text A fulll qualified class name. false

@hibernate.id (0..1)

Declares an identifier property

Parameter Type Applicability Description Mandatory
column text defaults to the property name. The name of the mapped database table column. false
type text A name that indicates the Hibernate type. false
length text The length of the mapped database table column. false
unsaved-value text A value that distiguishes transient instances with existing persistent state from new transient instances. false
generator-class text The key generator class true
generator-class-param-1 text Parameter for key generator class. false
generator-class-param-2 text Parameter for key generator class. false
generator-class-param-3 text Parameter for key generator class. false

@hibernate.version (0..1)

Declares a version property

Parameter Type Applicability Description Mandatory
column text The name of a column holding the version number. false

@hibernate.timestamp (0..1)

Declares a timestamp property

Parameter Type Applicability Description Mandatory
column text The name of an column holding the timestamp. false

@hibernate.many-to-one (0..1)

Declares a many-to-one association

Parameter Type Applicability Description Mandatory
column text Defaults to the property name. The name of the mapped database table column. false
class text Defaults to the property type determined by reflection. The name of the associated class. false
cascade text Specifies, which operations should be cascaded from the parent object to the associated object. false
not-null bool If the column is not nullable. false
unique bool If the column is unique. false
outer-join text Defaults to true. Enable outer-join fetching for this association when hibernate.use_outer_join is set. false

@hibernate.one-to-one (0..1)

Declares a one-to-one association

Parameter Type Applicability Description Mandatory
class text Defaults to the property type determined by reflection: The name of the associated class. false
cascade text Specifies, which operations should be cascaded from the parent object to the associated object. false
outer-join bool Defaults to true. Enable outer-join fetching for this association when hibernate.use_outer_join is set. false

@hibernate.collection (0..1)

Declare a toplevel collection property

Parameter Type Applicability Description Mandatory
role text The name of the toplevel collection role. true
column text The name of table column holding the key of the toplevel collection. true
length text The length of the column. true
not-null text Enable a not null constraint. true
unique text Enable a unique constraint. true
cascade text Specifies which operations should be cascaded from the parent object to the associated object. false

@hibernate.set (0..1)

Defines a set

Parameter Type Applicability Description Mandatory
role text The name of the toplevel collection role or nested collection property. true
readonly bool If readonly collection false
table text Defaults to role name: the name of the collection table (not used for one-to-many associations) false
schema text The name of a table schema to override the schema declared. false
lazy bool Defaults to false: enable lazy initialization. false
cascade text Specifies, which operations should be cascaded from the parent object to the associated object. false
sort text Specify a sorted collection with natural sort order, or a given comparator class. false
order-by text Specify table columns that define the iteratation order. false

@hibernate.bag (0..1)

Defines a bag

Parameter Type Applicability Description Mandatory
role text The name of the toplevel collection role or nested collection property. true
readonly bool If readonly collection false
table text Defaults to role name. The name of the collection table (not used for one-to-many associations) false
schema text The name of a table schema to override the schema declared. false
lazy bool Defaults to false. Enable lazy initialization. false
cascade text Specifies, which operations should be cascaded from the parent object to the associated object. false
order-by text Specify table columns that define the iteratation order. false

@hibernate.list (0..1)

Defines a List

Parameter Type Applicability Description Mandatory
role text The name of the toplevel collection role or nested collection property. true
table text Defaults to role name. The name of the collection table (not used for one-to-many associations) false
schema text The name of a table schema to override the schema declared. false
lazy bool Defaults to false. Enable lazy initialization. false
cascade text Specifies which operations should be cascaded from the parent object to the associated object. false

@hibernate.map (0..1)

Defines a map

Parameter Type Applicability Description Mandatory
role text The name of the toplevel collection role or nested collection property. true
table text Defaults to role name. The name of the collection table (not used for one-to-many associations) false
schema text The name of a table schema to override the schema declared. false
lazy bool Defaults to false. Enable lazy initialization. false
cascade text Specifies which operations should be cascaded from the parent object to the associated object. false
sort text Specify a sorted collection with natural sort order, or a given comparator class. false
order-by text Specify table columns that define the iteratation order. false

@hibernate.array (0..1)

Defines an array

Parameter Type Applicability Description Mandatory
role text The name of the toplevel collection role or nested collection property. true
table text Defaults to role name. The name of the collection table (not used for one-to-many associations) false
schema text The name of a table schema to override the schema declared. false
cascade text Specifies which operations should be cascaded from the parent object to the associated object. false

@hibernate.primitive-array (0..1)

Defines a primitive-array

Parameter Type Applicability Description Mandatory
role text The name of the toplevel collection role or nested collection property. true
table text Defaults to role name. The name of the collection table (not used for one-to-many associations) false
schema text The name of a table schema to override the schema declared. false
cascade text Specifies which operations should be cascaded from the parent object to the associated object. false

@hibernate.collection-key (0..1)

Declares a collection key

Parameter Type Applicability Description Mandatory
column text Defaults to the property name. The name of the mapped database table column. false
type text A name that indicates the Hibernate type. false
length text The length of the mapped database table column. false
generator-class text The key generator class (toplevel collections only) true
generator-class-param-1 text Parameter for key generator class. false
generator-class-param-2 text Parameter for key generator class. false
generator-class-param-3 text Parameter for key generator class. false

@hibernate.collection-index (0..1)

Declares a collection index

Parameter Type Applicability Description Mandatory
column text defaults to the property name. The name of the mapped database table column. false
type text A name that indicates the Hibernate type. false
length text The length of the mapped database table column. false

@hibernate.collection-element (0..1)

Declares a collection element

Parameter Type Applicability Description Mandatory
column text The name of the mapped database table column. false
type text A name that indicates the Hibernate type. false
length text The length of the mapped database table column. false

@hibernate.composite-element (0..1)

Declares a composite collection element

Parameter Type Applicability Description Mandatory
class text The name of the element class. true

@hibernate.collection-many-to-many (0..1)

Declares a many-to-many relationship

Parameter Type Applicability Description Mandatory
column text The name of the mapped database table column. false
class text Full qualified class name false

@hibernate.collection-one-to-many (0..1)

Declares a one-to-many relationship

Parameter Type Applicability Description Mandatory
class text Fully qualified class name for the collection contens false