http://weblogs.java.net/blog/ss141213/archive/2009/05/be_careful_whil.html

- Romain


2011/11/28 David Blevins <[email protected]>

> 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 <[email protected]>
> 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.
> >
>

Reply via email to