|
Hibernate example source code file (Mapping.hbm.xml)
The Hibernate Mapping.hbm.xml source code<?xml version="1.0"?> <!DOCTYPE hibernate-mapping SYSTEM "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" > <hibernate-mapping package="org.hibernate.test.idprops"> <!-- Person has an identitifer property named something other than 'id'; additionally, it has a non-identitifer property named 'id' --> <class name="Person" table="T_ID_PERSON"> <id name="pk" column="PK" type="long"> <generator class="assigned"/> </id> <property name="name" column="NAME" type="string"/> <property name="id" column="ID_NON_ID" type="int" /> </class> <!-- Order has an identitifer property named something other than 'id'; it has no non-identitifer property named 'id' --> <class name="Order" table="T_ID_ORDER"> <id name="number" column="PK" type="long"> <generator class="assigned"/> </id> <property name="placed" column="ORDR_DT" type="timestamp"/> <many-to-one name="orderee" class="Person" column="ORDEREE"/> <set name="lineItems" cascade="all-delete-orphan" lazy="true" inverse="true"> <key column="ORDR_ID"/> <one-to-many class="LineItem"/> </set> </class> <!-- LineItem has a composite identitifer property named something other than 'id'; additionally, it has a non-identitifer property named 'id' --> <class name="LineItem" table="T_ID_LINE_ITEM"> <composite-id class="LineItemPK" name="pk"> <key-many-to-one name="order" class="Order" column="ORDR_ID" /> <key-property name="productCode" column="PROD_CODE" type="string"/> </composite-id> <property name="quantity" column="QTY" type="int"/> <property name="id" column="ID_NON_ID2" type="string"/> </class> </hibernate-mapping> Other Hibernate examples (source code examples)Here is a short list of links related to this Hibernate Mapping.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.