Property in Hibernate Mapping:
<property
name="propertyName"
column="column_name"
type="typename"
update="true|false"
insert="true|false"
formula="arbitrary SQL expression"
access="field|property|ClassName"
lazy="true|false"
unique="true|false"
not-null="true|false"
optimistic-lock="true|false"
generated="never|insert|always"
node="element-name|@attribute-name|element/@attribute|." index="index_name" unique_key="unique_key_id" length="L" precision="P" scale="S"
/>
Tag |
Description |
name |
In the property tag we use the name for the using the name of the property with an initial lowercase letter |
column(optional) |
We see the this defaults as property name. Name of the mapped database table column. This can also be specified by nested <column> elements |
type(optional) |
This name indicate the hibernate type. |
update,insert(optional) |
We found this on defaults true. This specifies that the mapped columns should be included in SQL UPDATE and INSERT statements. We set both to false allows a pure “derived” property whose value is initialized from some other property that maps to the same column or we can say it by a trigger of other application. |
formula(optional) |
In hibernate an sql expression that defines the value for a computed property. We found the computed property do not have a column mapping of their own. |
access(optional) |
It set on by defaults to property. It show the strategy hibernate uses for accessing the property value. |
lazy(optional) |
It set to defaults false. It specifies that this property should be fetched lazily when the instances variable is first accessed. It requires build-time bytecode instrumentation. |
unique(optional) |
It enable the DDL generation of a unique constraint for the column so we allows this to be the target of a property set. |
not-null(optional) |
It enables the DDL generation of a nullability constraint for the columns. |
optimistic-lock(optional) |
It found by defaults on true. It specifies that updates to this property do or do not require acquisition of the optimistic lock. We can say in other word, it determines if a version increment shold occur when this property is dirty. |
generated(optional) |
It can't set by defaults never. It specifies that this propety value is actually generated by the database. |