alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (mappings.hbm.xml)

This example Hibernate source code file (mappings.hbm.xml) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

discriminator, doctype, dtd//en, hibernate/hibernate, id, id, id_master, id_master, mapping, mapping, str, str2, str3, sub2

The Hibernate mappings.hbm.xml source code

<?xml version="1.0" encoding="WINDOWS-1251"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>

	<class
		name="org.hibernate.envers.test.integration.onetomany.inverseToSuperclass.Master"
		table="HIB_MASTER_ENTITY">

		<id name="id" column="ID" type="long">
			<generator class="increment" />
		</id>

		<property name="str" column="STR" />

		<bag name="items" lazy="true" cascade="all" access="property"
			inverse="true">
			<key column="ID_MASTER" />
			<one-to-many
				class="org.hibernate.envers.test.integration.onetomany.inverseToSuperclass.DetailSubclass2" />
		</bag>
	</class>


	<class
		name="org.hibernate.envers.test.integration.onetomany.inverseToSuperclass.DetailSuperclass"
		table="HIB_DETAIL_ENTITY" abstract="true">
		<id name="id" column="ID" type="long">
			<generator class="increment" />
		</id>
		<discriminator column="DISCRIMINATOR" type="string" />

		<many-to-one name="parent" column="ID_MASTER" 
			class="org.hibernate.envers.test.integration.onetomany.inverseToSuperclass.Master" />

		<subclass
			name="org.hibernate.envers.test.integration.onetomany.inverseToSuperclass.DetailSubclass"
			discriminator-value="SUB">
			<property name="str2" column="STR2" />

			<subclass
				name="org.hibernate.envers.test.integration.onetomany.inverseToSuperclass.DetailSubclass2"
				discriminator-value="SUB2" extends="org.hibernate.envers.test.integration.onetomany.inverseToSuperclass.DetailSubclass">
				<property name="str3" column="STR3" />
	
			</subclass>

		</subclass>
	</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

 

new blog posts

 

Copyright 1998-2024 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.