Properties Tag in Hibernate: Hibenate has a different kind of operation for that required the some basic tag to do that operation. In this list we found the property tag. <properties> permissed to allow to the element definition with name,logical grouping of the properties of a class. The most important use of this is to construct and allows a combination of properties to be target of a property-ref. It is also convenient way to define a multi-column unique constraint.
We can take a simple example for this to understand which is given below:
<properties
name="logicalName"
insert="true|false"
update="true|false"
optimistic-lock="true|false"
unique="true|false">
<property ...../> <many-to-one .... /> ........ </properties>
To understand the below code of example we have given a small description of each point:
Property Name |
Description |
name |
It is a logical name of the grouping. It is not an actual property name. |
insert |
With the help of this we can do the mapped column appear in SQL INSERT |
update |
With the help of this we can do the mapped column appear in SQL UPDATE |
optimistic-lock(optional) |
It specifies that updates to these properties either do or do not require acquistion of the optimistic lock. It determines if a version increment should occur whrn these properties are dirty. |
unique(otional) |
It found on the by defaults false. It specifies that a unique constraint exists upon all maped columns of the componant. |