title: Spring OpenSessionInViewInterceptor doesn't work
body: <p>I had the (in)famous problem with hibernate and lazy loading when views are rendered.... As many say, the only two solutions are:</p>
  
  <ul>
  <li>Make the method transactional (and this is not always desiderable)</li>
  <li>Use OpenSessionInViewInterceptor. </li>
  </ul>
  
  <p>The latter is preferable IMO. Anyway I'm not sure if this interceptor is firing at all (in fact I get the same Lazy loading exception and nothing changes):</p>
  
  <pre><code>org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: it.jsoftware.jacciseweb.beans.Listino.prodotti, no session or session was closed
  </code></pre>
  
  <p>I'm using simple annotation based url mappings, so reading the docs for Spring 3, I'm using this in my servlet-context.xml:</p>
  
  <pre><code>&lt;bean id="handlerMapping"
          class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"&gt;
          &lt;!-- &lt;property name="order" value="2" /&gt; --&gt;
          &lt;property name="interceptors"&gt;
              &lt;list&gt;
                  &lt;ref bean="openSessionInViewInterceptorInst" /&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  </code></pre>
  
  <p>Which should make the trick. But it is not working and I get the exception. How do I make sure my interceptor is firing? How do I solve this?</p>