Added petclinic sample
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- Custom aspects for the PetClinic sample application -->
|
||||
<aspectj>
|
||||
|
||||
<weaver>
|
||||
<include within="org.springframework.samples.petclinic..*"/>
|
||||
</weaver>
|
||||
|
||||
<aspects>
|
||||
<aspect name="org.springframework.samples.petclinic.aspects.UsageLogAspect"/>
|
||||
<concrete-aspect name="org.springframework.samples.petclinic.aspects.ApplicationTraceAspect"
|
||||
extends="org.springframework.samples.petclinic.aspects.AbstractTraceAspect">
|
||||
<pointcut name="traced" expression="execution(* org.springframework.samples..*.*(..))"/>
|
||||
</concrete-aspect>
|
||||
</aspects>
|
||||
|
||||
</aspectj>
|
||||
@@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
|
||||
version="1.0">
|
||||
|
||||
<persistence-unit-metadata>
|
||||
<xml-mapping-metadata-complete/>
|
||||
<persistence-unit-defaults>
|
||||
<access>PROPERTY</access>
|
||||
</persistence-unit-defaults>
|
||||
</persistence-unit-metadata>
|
||||
|
||||
<package>org.springframework.samples.petclinic</package>
|
||||
|
||||
<mapped-superclass class="BaseEntity">
|
||||
<attributes>
|
||||
<id name="id">
|
||||
<generated-value strategy="IDENTITY"/>
|
||||
</id>
|
||||
<transient name="new"/>
|
||||
</attributes>
|
||||
</mapped-superclass>
|
||||
|
||||
<mapped-superclass class="NamedEntity">
|
||||
<attributes>
|
||||
<basic name="name">
|
||||
<column name="NAME"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</mapped-superclass>
|
||||
|
||||
<mapped-superclass class="Person">
|
||||
<attributes>
|
||||
<basic name="firstName">
|
||||
<column name="FIRST_NAME"/>
|
||||
</basic>
|
||||
<basic name="lastName">
|
||||
<column name="LAST_NAME"/>
|
||||
</basic>
|
||||
</attributes>
|
||||
</mapped-superclass>
|
||||
|
||||
<entity class="Vet">
|
||||
<table name="VETS"/>
|
||||
<attributes>
|
||||
<many-to-many name="specialtiesInternal" target-entity="Specialty" fetch="EAGER">
|
||||
<join-table name="VET_SPECIALTIES">
|
||||
<join-column name="VET_ID"/>
|
||||
<inverse-join-column name="SPECIALTY_ID"/>
|
||||
</join-table>
|
||||
</many-to-many>
|
||||
<transient name="specialties"/>
|
||||
<transient name="nrOfSpecialties"/>
|
||||
</attributes>
|
||||
</entity>
|
||||
|
||||
<entity class="Specialty">
|
||||
<table name="SPECIALTIES"/>
|
||||
</entity>
|
||||
|
||||
<entity class="Owner">
|
||||
<table name="OWNERS"/>
|
||||
<attributes>
|
||||
<basic name="address"/>
|
||||
<basic name="city"/>
|
||||
<basic name="telephone"/>
|
||||
<one-to-many name="petsInternal" target-entity="Pet" mapped-by="owner" fetch="EAGER">
|
||||
<cascade>
|
||||
<cascade-all/>
|
||||
</cascade>
|
||||
</one-to-many>
|
||||
<transient name="pets"/>
|
||||
</attributes>
|
||||
</entity>
|
||||
|
||||
<entity class="Pet">
|
||||
<table name="PETS"/>
|
||||
<attributes>
|
||||
<basic name="birthDate">
|
||||
<column name="BIRTH_DATE"/>
|
||||
<temporal>DATE</temporal>
|
||||
</basic>
|
||||
<many-to-one name="owner" fetch="EAGER">
|
||||
<cascade>
|
||||
<cascade-all/>
|
||||
</cascade>
|
||||
</many-to-one>
|
||||
<many-to-one name="type" fetch="EAGER">
|
||||
<cascade>
|
||||
<cascade-all/>
|
||||
</cascade>
|
||||
</many-to-one>
|
||||
<one-to-many name="visitsInternal" target-entity="Visit" mapped-by="pet" fetch="EAGER">
|
||||
<cascade>
|
||||
<cascade-all/>
|
||||
</cascade>
|
||||
</one-to-many>
|
||||
<transient name="visits"/>
|
||||
</attributes>
|
||||
</entity>
|
||||
|
||||
<entity class="PetType">
|
||||
<table name="TYPES"/>
|
||||
</entity>
|
||||
|
||||
<entity class="Visit">
|
||||
<table name="VISITS"/>
|
||||
<attributes>
|
||||
<basic name="date">
|
||||
<column name="VISIT_DATE"/>
|
||||
<temporal>DATE</temporal>
|
||||
</basic>
|
||||
<many-to-one name="pet" fetch="EAGER">
|
||||
<cascade>
|
||||
<cascade-all/>
|
||||
</cascade>
|
||||
</many-to-one>
|
||||
</attributes>
|
||||
</entity>
|
||||
|
||||
</entity-mappings>
|
||||
@@ -0,0 +1,16 @@
|
||||
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
|
||||
version="1.0">
|
||||
|
||||
<persistence-unit name="PetClinic" transaction-type="RESOURCE_LOCAL">
|
||||
|
||||
<!-- Explicitly define mapping file path, else Hibernate won't find the default -->
|
||||
<mapping-file>META-INF/orm.xml</mapping-file>
|
||||
|
||||
<!-- Prevent annotation scanning. In this app we are purely driven by orm.xml -->
|
||||
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||
|
||||
</persistence-unit>
|
||||
|
||||
</persistence>
|
||||
@@ -0,0 +1,48 @@
|
||||
# Properties file with JDBC and JPA settings.
|
||||
#
|
||||
# Applied by <context:property-placeholder location="jdbc.properties"/> from
|
||||
# various application context XML files (e.g., "applicationContext-*.xml").
|
||||
# Targeted at system administrators, to avoid touching the context XML files.
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# Common Settings
|
||||
|
||||
hibernate.generate_statistics=true
|
||||
hibernate.show_sql=true
|
||||
jpa.showSql=true
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# HSQL Settings
|
||||
|
||||
jdbc.driverClassName=org.hsqldb.jdbcDriver
|
||||
jdbc.url=jdbc:hsqldb:hsql://localhost:9001
|
||||
jdbc.username=sa
|
||||
jdbc.password=
|
||||
|
||||
# Property that determines which Hibernate dialect to use
|
||||
# (only applied with "applicationContext-hibernate.xml")
|
||||
hibernate.dialect=org.hibernate.dialect.HSQLDialect
|
||||
|
||||
# Property that determines which JPA DatabasePlatform to use with TopLink Essentials
|
||||
jpa.databasePlatform=org.springframework.samples.petclinic.toplink.EssentialsHSQLPlatformWithNativeSequence
|
||||
|
||||
# Property that determines which database to use with an AbstractJpaVendorAdapter
|
||||
jpa.database=HSQL
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# MySQL Settings
|
||||
|
||||
#jdbc.driverClassName=com.mysql.jdbc.Driver
|
||||
#jdbc.url=jdbc:mysql://localhost:3306/petclinic
|
||||
#jdbc.username=pc
|
||||
#jdbc.password=pc
|
||||
|
||||
# Property that determines which Hibernate dialect to use
|
||||
# (only applied with "applicationContext-hibernate.xml")
|
||||
#hibernate.dialect=org.hibernate.dialect.MySQLDialect
|
||||
|
||||
# Property that determines which JPA DatabasePlatform to use with TopLink Essentials
|
||||
#jpa.databasePlatform=oracle.toplink.essentials.platform.database.MySQL4Platform
|
||||
|
||||
# Property that determines which database to use with an AbstractJpaVendorAdapter
|
||||
#jpa.database=MYSQL
|
||||
@@ -0,0 +1,74 @@
|
||||
<?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>
|
||||
Reference in New Issue
Block a user