|
Hibernate example source code file (Mappings.hbm.xml)
The Hibernate Mappings.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"> <!-- ~ Hibernate, Relational Persistence for Idiomatic Java ~ ~ Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as ~ indicated by the @author tags or express copyright attribution ~ statements applied by the authors. All third-party contributions are ~ distributed under license by Red Hat Middleware LLC. ~ ~ This copyrighted material is made available to anyone wishing to use, modify, ~ copy, or redistribute it subject to the terms and conditions of the GNU ~ Lesser General Public License, as published by the Free Software Foundation. ~ ~ This program is distributed in the hope that it will be useful, ~ but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ~ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License ~ for more details. ~ ~ You should have received a copy of the GNU Lesser General Public License ~ along with this distribution; if not, write to: ~ Free Software Foundation, Inc. ~ 51 Franklin Street, Fifth Floor ~ Boston, MA 02110-1301 USA ~ --> <hibernate-mapping package="org.hibernate.test.manytomanyassociationclass"> <class name="User" table="HB_USER"> <id name="id" column="ID" type="long"> <generator class="native"/> </id> <property name="name" column="NAME" type="string" length="40" not-null="true"/> <set name="memberships" cascade="all, delete-orphan" inverse="true" lazy="true"> <key column="USER_ID"/> <one-to-many class="Membership"/> </set> </class> <class name="Group" table="HB_GROUP"> <id name="id" column="ID" type="long"> <generator class="native"/> </id> <property name="name" column="NAME" type="string" length="40" not-null="true"/> <set name="memberships" cascade="all, delete-orphan" inverse="true" lazy="true"> <key column="GROUP_ID"/> <one-to-many class="Membership"/> </set> </class> <class name="Membership" table="HB_MEMBERSHIP"> <id name="id" column="ID" type="long"> <generator class="native"/> </id> <property name="name" column="NAME" type="string" length="40" not-null="true"/> <many-to-one column="USER_ID" name="user" class="User" not-null="true" unique-key="UK_MEMBERSHIP"/> <many-to-one column="GROUP_ID" name="group" class="Group" not-null="true" unique-key="UK_MEMBERSHIP"/> </class> </hibernate-mapping> Other Hibernate examples (source code examples)Here is a short list of links related to this Hibernate Mappings.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.