tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: Could not locate SessionFactory in JNDI
Date Mon, 28 Nov 2011 15:31:26 GMT
http://weblogs.java.net/blog/ss141213/archive/2009/05/be_careful_whil.html

- Romain


2011/11/28 David Blevins <david.blevins@gmail.com>

> That's a great tip.  You should throw it in the docs.
>
> On my phone at the airport at the moment, but think we have a hibernate
> specific page that would be a great place for it.
>
> -David
>
> On Sunday, November 27, 2011, AndyG <andy.gumbrecht@orprovision.com>
> wrote:
> > Try this, if you really need to get to the hibernate session (you can
> then
> > get the factory from the session):
> >
> > private EntityManager em;
> >
> > @PersistenceContext(unitName = "your_context_name", type =
> > PersistenceContextType.TRANSACTION)
> > public final void setEntityManager(final EntityManager em) {
> >        this.em = em;
> > }
> >
> > ....
> >
> > final Session s = ((org.hibernate.ejb.EntityManagerImpl)
> > this.em.getDelegate()).getSession();
> >
> >
> > --
> > View this message in context:
>
> http://openejb.979440.n4.nabble.com/Could-not-locate-SessionFactory-in-JNDI-tp4113852p4114450.html
> > Sent from the OpenEJB User mailing list archive at Nabble.com.
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message