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

Spring Framework example source code file (petclinic.hbm.xml)

This example Spring Framework source code file (petclinic.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 - Spring Framework tags/keywords

clinic, clinic, doctype, dtd//en, hibernate, hibernate, hibernate/hibernate, mapping, mapping, public, utf-8, utf-8

The Spring Framework petclinic.hbm.xml source code

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
		"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<!--
  - Mapping file for the Hibernate implementation of the Clinic interface.
	-->
<hibernate-mapping auto-import="true" default-lazy="false">

	<class name="org.springframework.samples.petclinic.Vet" table="vets">
		<id name="id" column="id">
			<generator class="identity"/>
		</id>
		<property name="firstName" column="first_name"/>
		<property name="lastName" column="last_name"/>
		<set name="specialtiesInternal" table="vet_specialties">
			<key column="vet_id"/>
			<many-to-many column="specialty_id" class="org.springframework.samples.petclinic.Specialty"/>
		</set>
	</class>

	<class name="org.springframework.samples.petclinic.Specialty" table="specialties">
		<id name="id" column="id">
			<generator class="identity"/>
		</id>
		<property name="name" column="name"/>
	</class>

	<class name="org.springframework.samples.petclinic.Owner" table="owners">
		<id name="id" column="id">
			<generator class="identity"/>
		</id>
		<property name="firstName" column="first_name"/>
		<property name="lastName" column="last_name"/>
		<property name="address" column="address"/>
		<property name="city" column="city"/>
		<property name="telephone" column="telephone"/>
		<set name="petsInternal" inverse="true" cascade="all">
			<key column="owner_id"/>
			<one-to-many class="org.springframework.samples.petclinic.Pet"/>
		</set>
	</class>

	<class name="org.springframework.samples.petclinic.Pet" table="pets">
		<id name="id" column="id">
			<generator class="identity"/>
		</id>
		<property name="name" column="name"/>
		<property name="birthDate" column="birth_date" type="date"/>
		<many-to-one name="owner" column="owner_id" class="org.springframework.samples.petclinic.Owner"/>
		<many-to-one name="type" column="type_id" class="org.springframework.samples.petclinic.PetType"/>
		<set name="visitsInternal" inverse="true" cascade="all">
			<key column="pet_id"/>
			<one-to-many class="org.springframework.samples.petclinic.Visit"/>
		</set>
	</class>

	<class name="org.springframework.samples.petclinic.PetType" table="types">
		<id name="id" column="id">
			<generator class="identity"/>
		</id>
		<property name="name" column="name"/>
	</class>

	<class name="org.springframework.samples.petclinic.Visit" table="visits">
		<id name="id" column="id">
			<generator class="identity"/>
		</id>
		<property name="date" column="visit_date" type="date"/>
		<property name="description" column="description"/>
		<many-to-one name="pet" column="pet_id" class="org.springframework.samples.petclinic.Pet"/>
	</class>

</hibernate-mapping>

Other Spring Framework examples (source code examples)

Here is a short list of links related to this Spring Framework petclinic.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.