Personally I am doing it this way:

/**
  |  * Tiny sugar class for getting the hibernate session from an EntityManager.
  |  */
  | public class GetHibernateSession {
  |    // wow, cool idiom!
  |    private static final Logger log = Logger.getLogger(new 
Throwable().getStackTrace()[0].getClass());
  | 
  |    private GetHibernateSession () { }
  | 
  |    public static Session get (EntityManager entityManager) {
  |       Session delegate = (Session)entityManager.getDelegate();
  |       return delegate;
  |    }
  | }
Use like so:
      GetHibernateSession.get(entityManager).enableFilter("priorChangeset")
  |             .setParameter("changeset_id", changeset.getId());
Works for me :-)  And no need for hibernate.cfg.xml when I already have a 
persistence.xml....

Cheers!
Rob

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

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

Reply via email to