Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your config looks correct with the SpringOpenEntityManagerInViewFilter so you SHOULDN'T have to resort to eager fetching or having to pre-traverse the collection in your controller. I have a very similar configuration and pattern in an app I'm working on, and it's working without problems. One thing you could try is to add a blank context location to your DispatcherServlet configuration. Haven't checked, but I think it has some default behaviour to load context according to global config otherwise. This will cause the dispatcher servlet to, in effect, load a separate context rather than just creating a blank one, inheriting from the one created by the ContextLoaderListener (which is what you want it to do).</p> <p>So, to your <code>&lt;servlet&gt;</code> declaration of the DispatcherServlet, add: </p> <pre><code>&lt;init-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;&lt;/param-value&gt; &lt;/init-param&gt; </code></pre> <p>Update: Using the hibernate transaction manager looks a bit odd as well (considering you are using a JPA entity manager). Try changing that to use the Jpa Transaction manager instead.</p> <pre><code>&lt;bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt; &lt;property name="entityManagerFactory" ref="entityManagerFactory"/&gt; &lt;/bean&gt; </code></pre> <p>Update 2: Looking over your config again, it looks like you are using a weird mix of JPA and Hibernate. For instance, you are definig two transaction managers. Why? Also, you are using the <code>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</code> (which is JPA/EntityManager), while at the same time using the <code>org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor</code> (which is Hibernate/Session). How are you looking up your entities in your DAO? Using the hibernate session or the JPA EntityManager? It might be better to stick with either JPA or Hibernate to minimize collisions. </p> <p>I've also had trouble getting the <code>Open*InViewInteceptor</code>'s to work. The filters seem more stable (you have <code>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</code>, for instance if you decide on hibernate pure).</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload