|
Hibernate example source code file (Person.hbm.xml)
The Hibernate Person.hbm.xml source code<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <!-- Demonstrates mapping an "optional" one-to-one association. Basically a (zero or one)-to-one. Note that this is only conceptually possible on the non-constrained side of the association (the side without the FK). Also, it is impossible that the optional side be lazy; we must hit the target table to determine whether a matching row actually exists or not. This is so we can properly determine whether to use null or some value for the association property's value. --> <hibernate-mapping package="org.hibernate.test.onetoone.optional" default-access="field"> <class name="Entity"> <id name="name"/> <joined-subclass name="Person"> <key column="entityName"/> <one-to-one name="address" cascade="all" constrained="false" outer-join="false" lazy="proxy"/> </joined-subclass> <joined-subclass name="Org"> <key column="entityName"/> </joined-subclass> </class> <class name="Address"> <id name="entityName"/> <property name="street"/> <property name="state"/> <property name="zip"/> </class> </hibernate-mapping> Other Hibernate examples (source code examples)Here is a short list of links related to this Hibernate Person.hbm.xml source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.