此内容没有您所选择的语言版本。
23.4. Miscellaneous example mappings
These examples are available from the Hibernate test suite. You will find many other useful example mappings there by searching in the
test folder of the Hibernate distribution.
23.4.1. "Typed" one-to-one association 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
<class name="Person">
<id name="name"/>
<one-to-one name="address"
cascade="all">
<formula>name</formula>
<formula>'HOME'</formula>
</one-to-one>
<one-to-one name="mailingAddress"
cascade="all">
<formula>name</formula>
<formula>'MAILING'</formula>
</one-to-one>
</class>
<class name="Address" batch-size="2"
check="addressType in ('MAILING', 'HOME', 'BUSINESS')">
<composite-id>
<key-many-to-one name="person"
column="personName"/>
<key-property name="type"
column="addressType"/>
</composite-id>
<property name="street" type="text"/>
<property name="state"/>
<property name="zip"/>
</class>