-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: OpenEntityManagerInViewFilter on Glassfish doesn't work
PostPosted: Mon Aug 08, 2011 9:32 am 
Newbie

Joined: Tue Apr 12, 2011 11:28 am
Posts: 3
My project is built on Spring + JPA + Hibernate.
In my web.xml I have
Code:
    <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:
Code:
@Entity
public class Cat
{
    ...
    @ManyToOne(fetch = FetchType.LAZY, optional = false)
    private Person master;
    ...
}


Controller:
Code:
@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:
Code:
${cat.master}


In Tomcat JSP shows master field properly, in Glassfish it displays null.
Why ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.