One to One association is represent that another persistent class is declared using a one to one element.
<one-to-one
name="propertyName"
class="ClassName"
cascade="cascade_style"
constrained="true|false"
fetch="join|select"
property-ref="propertyNameFromAssociatedClass"
access="field|property|ClassName"
formula="any SQL expression"
lazy="proxy|no-proxy|false"
entity-name="EntityName"
node="element-name|@attribute-name|element/@attribute|." embed-xml="true|false" foreign-key="foreign_key_name"
/>
Property |
Description |
name |
It shows the name of the property. |
class(optional) |
We found this by default to the property type determined by reflection. This tells us the name of the associaited class. |
cascade(optional) |
It specifies which operations should be cascaded from the parent object to the associated object. |
constrained(optional) |
It specified that a foreign key constraint on the primary key of the mapped table and references the table of that associated class. In this option we found the affects the order in which save() and delete() are cascaded, and determines whether the association can be proxyied. It is also used by the schema export tool. |
fetch(optional) |
We found this by defaults to select. We need to choose between outer-join fetching or sequetial select fetching. |
property-ref(optional) |
The name of a property of the associated class that is joined to the priamry key of this class. So it is not specified, the primary key of the associated class is used. |
access(optional) |
We found this by default on the property. The strategy in hibernated uses for accessing the property value. |
formula(optional) |
It almost all one-to-one association map to the priamry key of the owning entity. If this is not the case,that can specify another column, column or expression to join on using an SQL formula. |
lazy(optional) |
It set by defaults to proxy. In single point association are proxied. lazy=â€no-proxy†specifies that the property should be fetched lazily when the instance variable is first accessed. It requires build-time bytecode instrumentation. lazy=â€false†specifies that the association will always be eagerly fetched. We need to remember is that if constrained=â€falseâ€, then proxying is impossible and hibernate will eagerly fetch the association. |
entity-name(optional) |
It represent the entity name of the associated class. |