mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 21:35:50 +00:00
JPA tuning
This commit is contained in:
parent
197888fef0
commit
681026758d
2 changed files with 17 additions and 2 deletions
|
@ -48,7 +48,7 @@ public class Pet extends NamedEntity {
|
||||||
@JoinColumn(name = "owner_id")
|
@JoinColumn(name = "owner_id")
|
||||||
private Owner owner;
|
private Owner owner;
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "pet", fetch = FetchType.EAGER)
|
@OneToMany(cascade = CascadeType.ALL, mappedBy = "pet")
|
||||||
private Set<Visit> visits;
|
private Set<Visit> visits;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||||
|
|
||||||
<context-param>
|
<context-param>
|
||||||
<param-name>spring.profiles.active</param-name>
|
<param-name>spring.profiles.active</param-name>
|
||||||
<param-value>jdbc</param-value>
|
<param-value>jpa</param-value>
|
||||||
<!-- Available profiles:
|
<!-- Available profiles:
|
||||||
<param-value>jdbc</param-value>
|
<param-value>jdbc</param-value>
|
||||||
<param-value>jpa</param-value> (in the case of plain JPA)
|
<param-value>jpa</param-value> (in the case of plain JPA)
|
||||||
|
@ -62,4 +62,19 @@ see here: http://static.springsource.org/spring/docs/current/spring-framework-re
|
||||||
<servlet-name>petclinic</servlet-name>
|
<servlet-name>petclinic</servlet-name>
|
||||||
</filter-mapping>
|
</filter-mapping>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<filter-name>openEntityManagerFilter</filter-name>
|
||||||
|
<filter-class>
|
||||||
|
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter
|
||||||
|
</filter-class>
|
||||||
|
<init-param>
|
||||||
|
<param-name>entityManagerFactoryBeanName</param-name>
|
||||||
|
<param-value>entityManagerFactory</param-value>
|
||||||
|
</init-param>
|
||||||
|
</filter>
|
||||||
|
|
||||||
|
<filter-mapping>
|
||||||
|
<filter-name>openEntityManagerFilter</filter-name>
|
||||||
|
<url-pattern>/owners/*</url-pattern>
|
||||||
|
</filter-mapping>
|
||||||
</web-app>
|
</web-app>
|
Loading…
Reference in a new issue