Skip to content

Commit

Permalink
JPA tuning
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Dubois committed Mar 2, 2013
1 parent 197888f commit 6810267
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Expand Up @@ -48,7 +48,7 @@ public class Pet extends NamedEntity {
@JoinColumn(name = "owner_id")
private Owner owner;

@OneToMany(cascade = CascadeType.ALL, mappedBy = "pet", fetch = FetchType.EAGER)
@OneToMany(cascade = CascadeType.ALL, mappedBy = "pet")
private Set<Visit> visits;


Expand Down
17 changes: 16 additions & 1 deletion src/main/webapp/WEB-INF/web.xml
Expand Up @@ -10,7 +10,7 @@ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

<context-param>
<param-name>spring.profiles.active</param-name>
<param-value>jdbc</param-value>
<param-value>jpa</param-value>
<!-- Available profiles:
<param-value>jdbc</param-value>
<param-value>jpa</param-value> (in the case of plain JPA)
Expand Down Expand Up @@ -62,4 +62,19 @@ see here: http://static.springsource.org/spring/docs/current/spring-framework-re
<servlet-name>petclinic</servlet-name>
</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>

0 comments on commit 6810267

Please sign in to comment.