[jboss-user] [JBoss Seam] - Re: Mixing Hibernate & EJB3
RobJellinghaus
do-not-reply at jboss.com
Fri Jul 28 01:34:09 EDT 2006
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
More information about the jboss-user
mailing list