19 Apr 2007 21:51
Not finding the table and opening a database
Mirror Spock <robins80 <at> msu.edu>
2007-04-19 19:51:16 GMT
2007-04-19 19:51:16 GMT
I'm trying to write a standalone program that uses EJB persistence and I
have two problems:
1) How can you set up the connection so that it will open the database
if it exists and create one if it doesn't?
2) When I try to persist an object, it tells me that the table doesn't
exist. I'm using hibernate and mckoi and I was under the impression
that the persistence layer would take care of creating the table. What
could I be doing wrong?
Here's my error listing:
Exception in thread "main" javax.persistence.PersistenceException:
org.hibernate.exception.GenericJDBCException: could not insert: [Item]
at
org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630)
at
org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:219)
at DatabaseClient.main(DatabaseClient.java:60)
Caused by: org.hibernate.exception.GenericJDBCException: could not
insert: [Item]
at
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at
org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:40)
at
(Continue reading)
RSS Feed