Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions petclinic/trunk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<properties>
<spring.version>3.0.0.RELEASE</spring.version>
<spring.version>3.0.5.RELEASE</spring.version>
<slf4j.version>1.5.6</slf4j.version>
</properties>
<dependencies>
Expand Down Expand Up @@ -226,7 +226,6 @@
<version>1.1.0</version>
<scope>test</scope>
</dependency>

</dependencies>
<repositories>
<repository>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ public void addPet(Pet pet) {
pet.setOwner(this);
}

public void removePet(Pet pet) {
getPetsInternal().remove(pet);
}

/**
* Return the Pet with the given name, or null if none found for this Owner.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public void storeVisit(Visit visit) {

public void deletePet(int id) throws DataAccessException {
Pet pet = loadPet(id);
pet.getOwner().removePet(pet);
sessionFactory.getCurrentSession().delete(pet);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public void storeVisit(Visit visit) {

public void deletePet(int id) throws DataAccessException {
Pet pet = loadPet(id);
pet.getOwner().removePet(pet);
this.em.remove(pet);
}

Expand Down
12 changes: 2 additions & 10 deletions petclinic/trunk/src/main/resources/META-INF/orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,8 @@
<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>
<many-to-one name="owner" fetch="EAGER"/>
<many-to-one name="type" fetch="EAGER"/>
<one-to-many name="visitsInternal" target-entity="Visit" mapped-by="pet" fetch="EAGER">
<cascade>
<cascade-all/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<exclusions>
<module name="org.hibernate"/>
</exclusions>
</deployment>
</jboss-deployment-structure>
31 changes: 20 additions & 11 deletions petclinic/trunk/src/main/webapp/WEB-INF/petclinic-servlet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,37 @@
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
xmlns:oxm="http://www.springframework.org/schema/oxm"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd">
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">

<!--
- The controllers are autodetected POJOs labeled with the @Controller annotation.
-->
<context:component-scan base-package="org.springframework.samples.petclinic.web"/>

<!--
- The form-based controllers within this application provide @RequestMapping
- annotations at the type level for path mapping URLs and @RequestMapping
- at the method level for request type mappings (e.g., GET and POST).
- In contrast, ClinicController - which is not form-based - provides
- The form-based controllers within this application provide @RequestMapping
- annotations at the type level for path mapping URLs and @RequestMapping
- at the method level for request type mappings (e.g., GET and POST).
- In contrast, ClinicController - which is not form-based - provides
- @RequestMapping only at the method level for path mapping URLs.
-
- DefaultAnnotationHandlerMapping is driven by these annotations and is
- enabled by default with Java 5+.

-->

<!--
<mvc:resources mapping="/static/**" location="/" />

<mvc:default-servlet-handler/>

<mvc:view-controller path="/" view-name="welcome"/>

<!-- org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping is not enabled by default
in Spring 3.0.5 -->
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
<property name="order" value="1" />
</bean>
<!--
- This bean processes annotated handler methods, applying PetClinic-specific PropertyEditors
- for request parameter binding. It overrides the default AnnotationMethodHandlerAdapter.
-->
Expand All @@ -34,7 +44,6 @@
<bean class="org.springframework.samples.petclinic.web.ClinicBindingInitializer"/>
</property>
</bean>

<!--
- This bean resolves specific types of exceptions to corresponding logical
- view names for error views. The default behaviour of DispatcherServlet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@
<!-- import the dataSource definition -->
<import resource="applicationContext-dataSource.xml"/>

<!--
Activates a load-time weaver for the context. Any bean within the context that
implements LoadTimeWeaverAware (such as LocalContainerEntityManagerFactoryBean)
will receive a reference to the autodetected load-time weaver.
-->
<context:load-time-weaver/>

<!-- Configurer that replaces ${...} placeholders with values from a properties file -->
<!-- (in this case, JDBC-related settings for the JPA EntityManager definition below) -->
Expand All @@ -31,16 +25,14 @@
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
p:dataSource-ref="dataSource">
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter"
p:databasePlatform="${jpa.databasePlatform}" p:showSql="${jpa.showSql}"/>
<!--<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"-->
<!--p:databasePlatform="${jpa.databasePlatform}" p:showSql="${jpa.showSql}"/>-->
<!--
<bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter"
p:database="${jpa.database}" p:showSql="${jpa.showSql}"/>
-->
<!--
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
p:database="${jpa.database}" p:showSql="${jpa.showSql}"/>
-->
</property>
<property name="persistenceXmlLocation" value="classpath:META-INF/jpa-persistence.xml"/>
</bean>
Expand Down
Loading