G
Giovanni Azua
hi,
I have the following dependencies: Hibernate, Hibernate-EntityManager and
OpenEJB latest implementation.
In one of my Container Managed Dao implementations I have the snippet below
which is the way to get the underlying Hibernate Session from the
EntityManager injected by the container (note the double level of
indirection 2x getDelegate). My question is how portable is this code? if I
wish to use now lets say JBoss or Oracle AS or WebSphere would this code
remain unchanged or there would be a different way?
Many thanks in advance,
Best regards,
Giovanni
//--------------------------------------------------------------------
@PersistenceContext(unitName = "movie-unit",
type = PersistenceContextType.EXTENDED)
public void
setEntityManager(EntityManager anEntityManager)
{
EntityManager myActualEntityManager = anEntityManager.
getDelegate();
Object myActualSession = myActualEntityManager.getDelegate();
return myActualSession;
}
I have the following dependencies: Hibernate, Hibernate-EntityManager and
OpenEJB latest implementation.
In one of my Container Managed Dao implementations I have the snippet below
which is the way to get the underlying Hibernate Session from the
EntityManager injected by the container (note the double level of
indirection 2x getDelegate). My question is how portable is this code? if I
wish to use now lets say JBoss or Oracle AS or WebSphere would this code
remain unchanged or there would be a different way?
Many thanks in advance,
Best regards,
Giovanni
//--------------------------------------------------------------------
@PersistenceContext(unitName = "movie-unit",
type = PersistenceContextType.EXTENDED)
public void
setEntityManager(EntityManager anEntityManager)
{
EntityManager myActualEntityManager = anEntityManager.
getDelegate();
Object myActualSession = myActualEntityManager.getDelegate();
return myActualSession;
}