23.4.1. "Typed" one-to-one association

  1. <class name="Person">
  2. <id name="name"/>
  3. <one-to-one name="address"
  4. cascade="all">
  5. <formula>name</formula>
  6. <formula>'HOME'</formula>
  7. </one-to-one>
  8. <one-to-one name="mailingAddress"
  9. cascade="all">
  10. <formula>name</formula>
  11. <formula>'MAILING'</formula>
  12. </one-to-one>
  13. </class>
  14. <class name="Address" batch-size="2"
  15. check="addressType in ('MAILING', 'HOME', 'BUSINESS')">
  16. <composite-id>
  17. <key-many-to-one name="person"
  18. column="personName"/>
  19. <key-property name="type"
  20. column="addressType"/>
  21. </composite-id>
  22. <property name="street" type="text"/>
  23. <property name="state"/>
  24. <property name="zip"/>
  25. </class>