@Hibernate Tag Reference
Tags for Declaration of Hibernate Descriptor File
Applies TO: All classes, At Class level and on getter methods
@Hibernate Class Level Tags
@ hibernate.cache
@ hibernate.class
@ hibernate.discriminator
@ hibernate.jcs-cache
@ hibernate.joined-subclass
@ hibernate.joined-subclass-key
@ hibernate.mapping
@ hibernate.query
@ hibernate.subclass
@Hibernate Method Level Tags
@ hibernate.Any
@ hibernate.Any-color
@ Hibernate.Array
@ hibernate.bag
@ hibernate.collection-cache
@ hibernate.collection-Composite-Element
@ hibernate.collection-element
@ hibernate.collection-index
@ hibernate.collection-jcs-cache
@ hibernate.collection-key
@ hibernate.collection-key-color
@ Hibernate.collection-Many-to-Many
@ hibernate.collection-one-to-many
@ hibernate.column
@ hibernate.component
@ hibernate.generator-param
@ hibernate.id
@ Hibernate.index-Many-to-Many
@ hibernate.list
@ hibernate.many-to-any
@ hibernate.many-to-any-color
@ hibernate.many-to-one
@ hibernate.map
@ hibernate.one-to-one
@ hibernate.parent
@ hibernate.primitive-array
@ hibernate.property
@ hibernate.set
@ Hibernate.TimeStamp
@ Hibernate.Version
@Hibernate Field Level Tags
@Hibernate Class Level Tag Usage
@ hibernate.cache (0..1)
Enables caching
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryusageTextDefines the cache semanticsvalid options Are: read-writenstrict-read-writeeread-OnlyTransactionAltrue
@ hibernate.class (0..1)
Declare a personistent class
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorytabletextThe name of its database tablefalsediscriminator-valuetextA value that distinguishes the particular subclassfalsemutableboolSpecifies that instances of the class are (not) mutableDefault value (s): trueValid options are: truefalsefalsedynamic-updateboolSpecifies that only changed columns should appear in the SQL UPDATEDefault value (s) : falsefalsedynamic-insertboolSpecifies that null columns should not appear in the SQL INSERTDefault value (s): falsefalseselect-before-updateboolSpecifies that an SQL update should never be performed unless the object is actually modifiedDefault value (s): falsefalseoptimistic-locktextSpecifiy the optimistic locking strategy (requires dynamic-update = "true") Default value (s): versionValid options are: versionnonealldirtyfalsepolymorphismtextEnable "explicit" polymorphismDefault value (s): implicitValid options are: explicitimplicitfalseschematextOverride the schema name specified by the root hibernate-mapping elementfalselazyboolSpecifies the class itself to use for CGLIB proxy interfaceDefault value (s): falsefalseproxytextSpecifies an interface to use for CGLIB proxiesfalsewheretextthe where clause to use when loading elements for this classfalse@hibernate.discriminator (0..1)
Defines a Discriminator
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorycolumntextThe name of the mapped database table columntruetypetextThe Hibernate typefalselengthtextThe length of the mapped database table columnfalsenot-nullboolIs the column nullableDefault value (s): trueValid options are: truefalsefalseforceboolIndicate whether Hibernate should specify allowed discriminator values even when retrieving all instances of the root class Default. value (s): trueValid options are: truefalsefalseinsertboolSet this to false if your discriminator column is also part of a mapped composite identifier Default value (s):. trueValid options are: truefalsefalse@hibernate.jcs-cache (0..1)
Enables caching (deprecated)
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryusagetextDefines the cache semantics nonstrict-read-write only applies to version 2.0 and later.Valid options are:. Read-writenonstrict-read-writeread-onlytransactionaltrue
@ hibernate.joid-subclass (0..1)
Declare The Current Class As Joined Subclass
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorylazyboolSpecifies the class itself to use for CGLIB proxy interfaceDefault value (s): falsefalseproxytextSpecifies an interface to use for CGLIB proxiesfalsedynamic-updateboolSpecifies that only changed columns should appear in the SQL UPDATEDefault value (s): falsefalsedynamic-insertboolSpecifies that null columns should not appear in the SQL INSERTDefault value (s): falsefalseschematextOverride the schema name specified by the root hibernate-mapping elementfalsetabletextName of the table, where this class should be persisted inDefault value (s): unqualified class namefalse
@ hibernate.joined-subclass-key (0..1)
Declares a Joined-Subclass Key
Applies to: hibernateParameterTypeApplicabilityDescriptionMandatoryColumnTextthe name of the mapped database Table Columntrue
@ hibernate.mapping (0..1)
Customizes mapping decaration
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryschematextThe name of a database schemafalsedefault-cascadetextA default cascade styleDefault value (s): noneValid options are: nonesave-updatefalseauto-importboolSpecifies whether we can use unqualified class names (of classes in this mapping) in the query languageDefault value (s): trueValid options Are: Truefalsefalse
@ Hibernate.Query (0 .. *)
Declare a named Query for Class
Applies TO: Class Level on bean
ParameterTypeApplicabilityDescriptionMandatoryNameTextName of this QueryTrueQueryTextQuery Contentstrue
@ hibernate.subclass (0..1)
Declare the current class as subclass
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorytabletextThe name of its database tablefalsediscriminator-valuetextA value that distinguishes the particular subclassfalselazyboolSpecifies the class itself to use for CGLIB proxy interfaceDefault value (s): falsefalseproxytextSpecifies an interface to use for CGLIB proxiesfalsedynamic-updateboolSpecifies that only changed columns should appear in the SQL UPDATEDefault value ( S): Falsefalsedynamic-InsertBoolspecifies That Null Column Should Not Appear in The SQL INSERTDEFAULT VALUE (S): Falsefalse
@Hibernate Method Level Tag Usage
@ Hibernate.Any (0..1)
Declares any type mapping
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryId-typextType of the IdentifierTruemeta-TypetextMeta-typefalsecascadetextcascaDed Operationstrue
@ hibernate.Any-color (0 .. *)
Defines a column for the any type mappingapplies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorynametextThe column nametruelengthtextThe column lengthfalseuniqueboolIs the column uniquefalsenot-nullboolIs the column nullablefalseindextextThe name of an indexfalseunique-keytextThe name of a unique constraintfalsesql-typetextThe SQL column typefalse
@ hibernate.Array (0..1)
Defines an Array
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorytabletextThe name of the collection table (not used for one-to-many associations) falseschematextThe name of a table schema to override the schema declaredfalsecascadetextSpecifies which operations should be cascaded from the parent object to the associated objectValid options are: allnonesave-updatedeletefalsewheretextAn SQL WHERE conditionfalse
@ hibernate.bag (0..1)
Defines a Bag
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryinverseboolIf inverse collectionfalsetabletextThe name of the collection table (not used for one-to-many associations) falseschematextThe name of a table schema to override the schema declaredfalselazyboolEnable lazy initializationDefault value (s): falsefalsecascadetextSpecifies which operations should be cascaded from the parent object to the associated objectDefault value (s): noneValid options are: allnonesave-updatedeleteall-delete-orphandelete-orphanfalseorder-bytextSpecify table columns that define the iteration orderfalsewheretextAn SQL WHERE conditionfalse
@ hibernate.collection-cache (0..1)
Enables caching
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryusageTextDefines the cache semanticsvalid options Are: read-writenstrict-read-writeeread-OnlyTransactionAltrue
@ hibernate.collection-composite-element (0..1) Declares a Composite Collection Element Element
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryClasstextthe name of the element classtrue
@ hibernate.collection-element (0..1)
DECLARES A Collection Element
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorycolumntextThe name of the mapped database table columntruetypetextThe Hibernate typetruelengthtextThe length of the mapped database table columnfalsenot-nullboolIs the column nullablefalseuniqueboolIs the column uniquefalse
@ hibernate.collection-index (0..1)
Declares a collection index. This will be used as index for the arrays, sotring Field for the list or keys in the map
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorycolumntextThe name of the mapped database table columntruetypetextThe Hibernate typefalselengthtextThe length of the mapped database table columnfalse
@ hibernate.collection-jcs-cache (0..1)
Enables caching (deprecated)
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryusageTextDefines the cache semanticsvalid options Are: read-writenstrict-read-writeeread-OnlyTransactionAltrue
@ hibernate.collection-key (0..1)
DECLARES A Collection Key
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryColumnTextthe Name of the mapped Database Table Columntrue
@ hibernate.collection-key-color (0 .. *)
Defines a Column for a Collection Key
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorynametextThe column nametruelengthtextThe column lengthfalseuniqueboolIs the column uniquefalsenot-nullboolIs the column nullablefalseindextextThe name of an indexfalseunique-keytextThe name of a unique constraintfalsesql-typetextThe SQL column typefalse@hibernate.collection-many-to-many (0..1)
DECLARES A MANY-TO-MANY RELATIONSHIP
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorycolumntextThe name of the mapped database table columntrueclasstextFully qualified class namefalseouter-jointextEnable outer-join fetchingDefault value (s): autoValid options are: truefalseautofalse
@ hibernate.collection-one-to-many (0..1)
DECLARES A One-to-Many RelationShip
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryClasstextfully Qualified Class Name of the associated classfalse
@ hibernate.column (0 .. *)
Customize column mapping
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorynametextThe column nametruelengthtextThe column lengthfalseuniqueboolIs the column uniquefalsenot-nullboolIs the column nullablefalseindextextThe name of an indexfalseunique-keytextThe name of a unique constraintfalsesql-typetextThe SQL column typefalseformulatextAn SQL expression that defines the value for a computed property. Computed properties do not have a column mapping of their Own.false
@ hibernate.component (0..1)
Declares a component
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryclasstextA fully qualified class namefalseprefixtextWhen multiple Java fields are of the same component datatype, use this to specify a descriminating column-name-prefix. Properties that are included which have a @ hibernate.property column-name = "xxx" attribute will not be prefixed . If you want to shorten a property column-name and prefix it for the component, use @ hibernate.column name = "xxx" on the property.false@hibernate.generator-param (0.. *)
Specifies An ID Generator Parameter Value
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryNameTextthe Name of the ParametertrueValueTextthe Parameter Valuetrue
@ hibernate.id (0..1)
Declares an identifier property
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorycolumntextThe name of the mapped database table columnfalsetypetextThe Hibernate typefalselengthtextThe length of the mapped database table columnfalseunsaved-valuetextA value that distinguishes transient instances with existing persistent state from new transient instancesDefault value (s): nullfalsegenerator-classtextThe key generator classValid options are: uuid.hexuuid. StringIncrementAssignednativeIndInditySequenceHiloseqhiloForeigntrue
@ hibernate.index-many-to-many (0..1)
DECLARES MANY-TO-MANY Collection Index. Will BE Used As Map Key for Ternary Associations. SHALL BE Entity?
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorycolumntextThe name of the mapped database table columntrueclasstextEntity to be used as key in the ternary association mapstrueforeign-keytextThe name of the foreign key constraint to associate with this association.false
@ hibernate.list (0..1) Defines a list
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorytabletextThe name of the collection table (not used for one-to-many associations) falseschematextThe name of a table schema to override the schema declaredfalselazyboolEnable lazy initializationfalsecascadetextSpecifies which operations should be cascaded from the parent object to the associated objectsDefault value (s): noneValid options Are: AllnoneSave-Updatedletell-delete-orphander-orphanfalsewheretextan SQL Where ConditionFalse
@ hibernate.many-to-any (0..1)
DECLARES MANY-TO-ANY TYPE MAPPING
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryId-TypetextType of the IdentifierTruemeta-TypetextMeta-Typefalse
@ hibernate.many-to-any-color (0.. *)
Defines a column for the man-to-any type mapping
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorynametextThe column nametruelengthtextThe column lengthfalseuniqueboolIs the column uniquefalsenot-nullboolIs the column nullablefalseindextextThe name of an indexfalseunique-keytextThe name of a unique constraintfalsesql-typetextThe SQL column typefalse
@ hibernate.many-to-one (0..1)
Declares a Many-to-One Association
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorycolumntextThe name of the mapped database table columnfalseclasstextThe name of the associated classfalsecascadetextSpecifies which operations should be cascaded from the parent object to the associated objectDefault value (s): noneValid options are: allnonesave-updatedeletefalsenot-nullboolIf the column is not nullableDefault value (s): falsefalseuniqueboolIf the column is uniqueDefault value (s): falsefalseouter-jointextEnable outer-join fetchingDefault value (s): autoValid options are: truefalseautofalseinsertboolShould the column appear in the SQL INSERTfalseupdateboolShould the column appear in the SQL UPDATEfalseproperty-reftextThe name of a property of the associated class that is joined to this foreign key. If not specified, the primary key of the associated class is used.falseforeign-keytextThe name of the foreign key constraint to associate with this association.false@hibernate.map (0..1)
Defines a MAP
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorytabletextThe name of the collection table (not used for one-to-many associations) falseschematextThe name of a table schema to override the schema declaredfalselazyboolEnable lazy initializationfalsecascadetextSpecifies which operations should be cascaded from the parent object to the associated objectValid options are: allsave-updatedeletenoneall- delete-orphandelete-orphanfalsesorttextSpecify a sorted collection with natural sort order or a given comparator classfalseorder-bytextSpecify table columns that define the iteration orderfalsewheretextAn SQL WHERE conditionfalse
@ hibernate.one-to-one (0..1)
Declares a one-to-one association
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryclasstextThe name of the associated classfalseproperty-reftextbi-directional reference to one-to-one table that holds the foreign keyfalseconstrainedboolIs there a foreign key constraintfalsecascadetextSpecifies which operations should be cascaded from the parent object to the associated objectValid options are: allnonesave-updatedeletefalseouter-joinboolEnable outer -join fetching for this association when hibernate.use_outer_join is setDefault value (s): autoValid options are: truefalseautofalseforeign-keytextThe name of the foreign key constraint to associate with this association.false@hibernate.parent (0..1)
Declares a Parent Reference
Applies to: hibernate
@ hibernate.primitive-array (0..1)
Defines a primitive-array
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorytabletextThe name of the collection table (not used for one-to-many associations) falseschematextThe name of a table schema to override the schema declaredfalsecascadetextSpecifies which operations should be cascaded from the parent object to the associated objectValid options are: allnonesave-updatedeletefalsewheretextAn SQL WHERE conditionfalse
@ hibernate.property (0..1)
Defines a Property
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorycolumntextThe name of the mapped database table columnfalsetypetextThe Hibernate typefalselengthtextThe length of the mapped database table columnfalsenot-nullboolIf the column is not nullablefalseuniqueboolIf the column is uniquefalseinsertboolShould the column appear in the SQL INSERTfalseupdateboolShould the column appear in the SQL UPDATEfalseformulatextFormula for calculating the value of this proertyfalse
@ hibernate.set (0..1) Defines a set
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryinverseboolIf inverse collectionDefault value (s): falsefalsetabletextDefaults to role name: the name of the collection table (not used for one-to-many associations) falseschematextThe name of a table schema to override the schema declaredfalselazyboolEnable lazy initializationDefault value (s): falsefalsecascadetextSpecifies which operations should be cascaded from the parent object to the associated objectValid options are: allnonesave-updatedeleteall-delete-orphandelete-orphanfalsesorttextSpecify a sorted collection with natural sort order or a given comparator classfalseorder-bytextSpecify table columns that define the iteration orderfalsewheretextAn SQL WHERE conditionfalse
@ hibernate.timestamp (0..1)
DECLARES A TIMESTAMP PROPERTY
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatoryColumnTextthe Name of An Column Holding The TimeStampfalse
@ hibernate.version (0..1)
DECLARES A VERSION Property
Applies to: hibernate
ParameterTypeApplicabilityDescriptionMandatorycolumntextThe name of a column holding the version numberfalsetypetextThe Hibernate typeValid options are: integershortlongtimestampcalendarfalseaccesstextThe strategy Hibernate should use for accessing the property value.Default value (s): propertyValid options are: fieldpropertyClassNamefalseunsaved-valuetextA version property value that indicates that an instance is newly instantiated ( unsaved), distinguishing it from transient instances that were saved or loaded in a previous session (undefined specifies that the identifier property value should be used) .Default value (s): undefinedValid options are: nullnegativeundefinedfalse
@Hibernate Field Level Tag Usage