users@glassfish.java.net

OpenEntityManagerInViewFilter on Glassfish doesn't work

From: boraldo <boraldo_at_hotbox.ru>
Date: Tue, 9 Aug 2011 08:15:27 -0700 (PDT)

My project is built on Spring + JPA + Hibernate.
Here's pieces of files in my project

web.xml
    <filter>
        <filter-name>OpenEntityManagerInViewFilter</filter-name>
       
<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>OpenEntityManagerInViewFilter</filter-name>
        <servlet-name>spring</servlet-name>
    </filter-mapping>

JPA Entity:
@Entity
public class Cat
{
    ...
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private Person master;
    ...
}

Controller:
@Controller
public class CatController {
    @PersistenceContext
    protected EntityManager entityManager;
    @RequestMapping("/cat")
    public ModelAndView cat() {
        ModelAndView mav = new ModelAndView("cat");
        Cat cat = entityManager.find(Cat.class, 1);
        mav.addObject(cat);
        return mav;
    }
}

JSP:
${cat.master}

In Tomcat JSP shows master field properly, in Glassfish it displays null.
Why ?
-- 
View this message in context: http://old.nabble.com/OpenEntityManagerInViewFilter-on-Glassfish-doesn%27t-work-tp32227062p32227062.html
Sent from the java.net - glassfish users mailing list archive at Nabble.com.