Hi, I wonder if I'm the only one who's encountered this when trying to use the 
JPA delegate when Hibernate is the underlying persitence provider.

Look at chapter 8.4 in the doc. It says:


  | @In EntityManager entityManager;
  | 
  | @Create
  | public void init() {
  |     ( (Session) entityManager.getDelegate() 
).enableFilter("currentVersions");
  | }

>From my experience, entityManager.getDelegate() returns a 
>org.hibernate.ejb.EntityManagerImpl, not a org.hibernate.Session. So the code 
>in the example should be replaced by something like this:


  | @In EntityManager entityManager;
  | 
  | @Create
  | public void init() {
  |     ( (Session) 
((HibernateEntityManager)em.getDelegate()).getSession()).enableFilter("currentVersions");
  | }

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4023308#4023308

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4023308
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to