Thank you for this advice. I created a statless Sessionbean as followed:
Code:
@Stateless
public class BaseSession implements BaseSessionRemote, BaseSessionLocal
{
@Resource SessionContext context;
@PersistenceContext(unitName="myName") private EntityManager entityManager;
public Map<String,EntityPersister> getAllClassMetadata()
{
Map<String,EntityPersister> metadata = null;
try
{
HibernateEntityManager hibernateEntityManager = (HibernateEntityManager)entityManager.getDelegate();
metadata = hibernateEntityManager.getSession().getSessionFactory().getAllClassMetadata();
}
catch(ClassCastException e)
{
LoggerImpl.getInstance().log(Logger.iLOGG_ERROR, this, e);
metadata = new HashMap<String,EntityPersister>();
}
return metadata;
}
}
And that works fine!!