sagimann wrote:
1. Could you pls post the entire stack trace?
2. Are you sure hibernate is using the correct schema.table? i.e. maybe the logged on user's default schema is not the one containing the desired table?
Stack trace posted below.
With regard to the login, I have been incrementally adding tables to the database by adding the @Entity annotation to additional classes. Things have been
working fine, i.e. I can persist and retrieve data to/from the database using the EntityManager, until I added the latest class/table. The output from the descr command is from logging into the database with the same user id as is in my persistence.xml file.
Thanks.
[java] INFO com.ge.infra.icam.services.dms.util.JavaPersistenceUtils - static block: persistance unit = 'financialmodel'
[java] ERROR org.hibernate.AssertionFailure - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session)
[java] org.hibernate.AssertionFailure: Table INVOICE_GEN_BILLED_FE_MAP not found
[java] at org.hibernate.persister.entity.JoinedSubclassEntityPersister.getTableId(JoinedSubclassEntityPersister.java:458)
[java] at org.hibernate.persister.entity.JoinedSubclassEntityPersister.<init>(JoinedSubclassEntityPersister.java:237)
[java] at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:58)
[java] at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:226)
[java] at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
[java] at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:691)
[java] at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:121)
[java] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
[java] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
[java] at com.ge.services.dms.util.JavaPersistenceUtils.<clinit>(JavaPersistenceUtils.java:56)
[java] at com.ge.financialObjectModel.FinancialEntityHibernateTest.main(FinancialEntityHibernateTest.java:353)
Actual code:
static {
try {
ResourceBundleWrapper resourceBundle = new ResourceBundleWrapper (DMS_RESOURCE_BUNDLE_NAME) ;
String persistanceUnitName = resourceBundle.getValue (PERSISTANCE_UNIT_KEY) ;
_logger.info ("static block: persistance unit = '" + persistanceUnitName + "'") ;
// Start EntityManagerFactory
emf = Persistence.createEntityManagerFactory (persistanceUnitName) ; // <- line 56 of JavaPersistenceUtils
entityManagerFactoryCreated = true ;
} catch (Throwable ex) {
// Make sure you log the exception, as it might be swallowed
_logger.error ("static block: createEntityManagerFactory failed." + ex) ;
throw new ExceptionInInitializerError (ex) ;
}
}