Hi,
I want to get the name of table of a mapped class without using the way over configuration, I mean without this way:
Code:
Configuration cfg = new Configuration().configure();
Mappings m=cfg.createMappings();
System.out.println(">> class: "+m.getClass(className));
System.out.println("User table :: "+m.getClass("User").getTable());
I have a project based on seam running in JBoss, we mix in the entities Annotation and hbm.xml.
- If somebody know a way to access the configuration in seam over EntityManager this will be perhaps the way.
- If not, is There any way over EntityManager some thing like this:
Code:
Session session = (Session) getEntityManager().getDelegate();
ClassMetadata hibernateMetadata = session.getSessionFactory().getClassMetadata(entityClass);
if (hibernateMetadata instanceof AbstractEntityPersister){
AbstractEntityPersister persister = (AbstractEntityPersister) hibernateMetadata;
persister.getTableName();
}
Here I can get just the name of table, Know some body how can I get the table Object.
Thanks for your help.
Radouane el Marjani