I created a statless Sessionbean as followed:
| @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 then iterate over all maped entities:
| Map m = myPortalSession.getEntityManager().getAllClassMetadata();
| Set<Map.Entry> s = m.entrySet();
| for (Map.Entry e : s)
| {
| System.out.println(e.getKey() + "--->" + e.getValue());
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017649#4017649
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017649
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user