-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: table not found initialization error
PostPosted: Tue Apr 29, 2008 10:15 am 
Newbie

Joined: Tue Feb 20, 2007 10:00 pm
Posts: 8
Hi,

I generated a set of tables using hbm2ddl and Hibernate annotations. Things had been working fine. I am trying to add another table. When I add the Hibernate annotations to my class to generate the new table, the SQL file looks fine and in fact the table is in the database (I am using Oracle 9i):

SQL> descr INVOICE_GEN_BILLED_FE_MAP ;
Name Null? Type
----------------------------------------- -------- ----------------------------
INVOICE_GENERATOR_ID NOT NULL NUMBER(19)
FINANCIAL_ENTITY_ID NUMBER(19)

However, when my code calls emf = Persistence.createEntityManagerFactory (persistanceUnitName) ;

I am getting a table not found error for the table above:

[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)

Any suggestions on what could cause this ?

Thanks.

ml


Top
 Profile  
 
 Post subject: questions
PostPosted: Tue Apr 29, 2008 5:52 pm 
Senior
Senior

Joined: Sun Jun 11, 2006 10:41 am
Posts: 164
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?


Top
 Profile  
 
 Post subject: Re: questions
PostPosted: Wed Apr 30, 2008 9:21 am 
Newbie

Joined: Tue Feb 20, 2007 10:00 pm
Posts: 8
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) ;
}
}


Top
 Profile  
 
 Post subject: suggestion
PostPosted: Wed Apr 30, 2008 12:06 pm 
Senior
Senior

Joined: Sun Jun 11, 2006 10:41 am
Posts: 164
Could you pls post the relevant hbm files?
Are you using secondary tables with the JOINED strategy by any chance? If so, is the article below relevant to you?
http://jira.jboss.org/jira/browse/EJBTHREE-647

thanks.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.