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

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

This example Hibernate source code file (Vehicle.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

car, car, doctype, dtd, hibernate/hibernate, mapping, mapping, person, public, type, v, v, vehicle, vehicle

The Hibernate Vehicle.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-mapping package="org.hibernate.test.entityname">

	<!-- Vehicle represents an abstract root of a union-subclass hierarchy -->
	<class name="Vehicle" abstract="true" entity-name="VEHICLE" discriminator-value="V">
		<id name="id" access="field" type="long">
			<generator class="increment"/>
		</id>
		<discriminator column="TYPE" type="string" />
		<property name="vin" type="string"/>
		<property name="owner" type="string"/>

		<!-- Car represents a concrete leaf of a union-subclass hierarchy with no concrete super -->
		<subclass name="Car" entity-name="CAR" discriminator-value="C"/>
	</class>
	<class name="Person">
		<id name="id">
			<generator class="increment" />
		</id>
		<property name="name" />
		<set name="cars" cascade="all">
			<key column="car_id"/>
			<one-to-many entity-name="VEHICLE"/>
		</set>
	</class>

</hibernate-mapping>

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate Vehicle.hbm.xml source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

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.