Hello...I am using Hibernate 2.1.3 over Pointbase 4.8. I am trying to persist an existing JavaBean value object class, so I wrote a .hbm.xml file after the fact. I did make the Java Bean Serializable, and added the toString(), hashCode(), and equals(Object other) that Hibernate would have generated from the .hbm.xml (based on code I saw in the O Reilly book.) In the .hbm.xml file I have tried both id generator class="native" and generator class="assigned".
Java code: The first line of interest is session.beginTransaction(). I create three instances of my class in a loop, calling session.save(...) each time.
After the loop completes, I call session.flush() and transaction.commit(). I then get a ClassCastException; here it is in context. In debug I can see that my class instance data members are populated, including the id. Has anyone seen this to know where I should look to correct this? Thank you.
17:15:56,498 DEBUG SessionImpl:2259 - Flushed: 3 insertions, 0 updates, 0 deletions to 3 objects
17:15:56,508 DEBUG SessionImpl:2264 - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
17:15:56,508 DEBUG Printer:75 - listing entities:
java.lang.ClassCastException
at net.sf.hibernate.type.StringType.toString(StringType.java:47)
at net.sf.hibernate.type.NullableType.toString(NullableType.java:78)
at net.sf.hibernate.impl.Printer.toString(Printer.java:49)
at net.sf.hibernate.impl.Printer.toString(Printer.java:82)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2270)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2228)
at com.test.dao.TestHibernate.main(TestHibernate.java:50)
17:15:56,559 DEBUG SessionImpl:560 - closing session
17:15:56,559 DEBUG SessionImpl:3327 - disconnecting session
17:15:56,559 DEBUG DriverManagerConnectionProvider:120 - returning connection to pool, pool size: 1
17:15:56,559 INFO SessionFactoryImpl:531 - closing
17:15:56,559 INFO DriverManagerConnectionProvider:143 - cleaning up connection pool: jdbc:pointbase:embedded:TestDB;database.home=c:/Test/TestDB
17:15:56,599 DEBUG CacheManager:182 - Attempting to create an existing instance. Existing instance returned.
17:15:56,599 DEBUG CacheManager:182 - Attempting to create an existing instance. Existing instance returned.
|