I'm getting an error on the Hibernate 3.0 example build. DB connections work, because the tables are created, and the first data insert query seems to work. The results are presumably rolled back when the next insert fails.
I can't find any other mention of this particular problem, so am willing to entertain the idea that I'm doing something wrong, but I'm doing so little ...
For some reason, on the second insert (the first bidder "oney 1 one"), a query is generated with 7 placeholders (id at the end), but only 5 are bound.
I changed only etc/hibernate.properties (commented out hsqld, uncommented oracle, and turned on show_sql and use_sql_comments)
and etc/log4j.properties (turned on debug for SQL and type).
I tried this with the ClassicQueryTranslatorFactory line uncommented and commented. The data below is with this line uncommented, but I don't think it makes any difference in this particular case.
I downloaded Hibernate 2.1.8, and the example ran as advertised. So I will start working with 2.1.8 for my testing purposes. Still, I'd like to work with 3.0, but I don't feel comfortable if the example breaks.
See below for details (per the topic template). I included both insert cursors and bind variable assignments as reported in the ant output.
Hibernate version: 3.0rc1
Mapping documents: shipped with Hibernate
Code between sessionFactory.openSession() and session.close(): shipped with Hibernate
Full stack trace of any exception that occurs:
[java] Exception in thread "main" java.lang.NullPointerException
[java] at oracle.jdbc.dbaccess.DBData.clearItem(DBData.java:431)
[java] at oracle.jdbc.dbaccess.DBDataSetImpl.clearItem(DBDataSetImpl.java:3528)
[java] at oracle.jdbc.driver.OraclePreparedStatement.checkBindTypes(OraclePreparedStatement.java:3271)
[java] at oracle.jdbc.driver.OraclePreparedStatement.setItem(OraclePreparedStatement.java:1154)
[java] at oracle.jdbc.driver.OraclePreparedStatement.setString(OraclePreparedStatement.java:1572)
[java] at org.hibernate.type.CharacterType.set(CharacterType.java:41)
[java] at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:62)
[java] at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:44)
[java] at org.hibernate.type.ComponentType.nullSafeSet(ComponentType.java:211)
[java] at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1592)
[java] at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1569)
[java] at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1820)
[java] at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2171)
[java] at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46)
[java] at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
[java] at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
[java] at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
[java] at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
[java] at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
[java] at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:669)
[java] at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:293)
[java] at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
[java] at org.hibernate.auction.Main.createTestAuctions(Main.java:345)
[java] at org.hibernate.auction.Main.main(Main.java:366)
Name and version of the database you are using:Oracle 9.2.0.1.0 on Mac OS X (10.3.8)
The generated SQL (show_sql=true):
/*insert org.hibernate.auction.User*/insert into AuctionUser (userName, "password", email, firstName, "initial", lastName, id) values (?, ?, ?, ?, ?, ?, ?)
Debug level Hibernate log excerpt:
[java] 14:18:37,543 DEBUG SQL:292 - /*insert org.hibernate.auction.User*/insert into AuctionUser (userName, "password", email, firstName, "initial", lastName, id) values (?, ?, ?, ?, ?, ?, ?)
[java] Hibernate: /*insert org.hibernate.auction.User*/insert into AuctionUser (userName, "password", email, firstName, "initial", lastName, id) values (?, ?, ?, ?, ?, ?, ?)
[java] 14:18:37,545 DEBUG StringType:59 - binding 'oldirty' to parameter: 1
[java] 14:18:37,548 DEBUG StringType:52 - binding null to parameter: 2
[java] 14:18:37,549 DEBUG StringType:59 - binding
'oldirty@hibernate.org' to parameter: 3
[java] 14:18:37,550 DEBUG StringType:59 - binding 'ol' dirty' to parameter: 4
[java] 14:18:37,551 DEBUG CharacterType:52 - binding null to parameter: 5
[java] 14:18:37,552 DEBUG StringType:59 - binding 'bastard' to parameter: 6
[java] 14:18:37,555 DEBUG LongType:59 - binding '1' to parameter: 7
[java] 14:18:37,558 DEBUG SQL:292 - /*insert org.hibernate.auction.User*/insert into AuctionUser (userName, "password", email, firstName, "initial", lastName, id) values (?, ?, ?, ?, ?, ?, ?)
[java] Hibernate: /*insert org.hibernate.auction.User*/insert into AuctionUser (userName, "password", email, firstName, "initial", lastName, id) values (?, ?, ?, ?, ?, ?, ?)
[java] 14:18:37,559 DEBUG StringType:59 - binding '1E1' to parameter: 1
[java] 14:18:37,560 DEBUG StringType:52 - binding null to parameter: 2
[java] 14:18:37,560 DEBUG StringType:59 - binding
'oney@hibernate.org' to parameter: 3
[java] 14:18:37,564 DEBUG StringType:59 - binding 'oney' to parameter: 4
[java] 14:18:37,565 DEBUG CharacterType:59 - binding '1' to parameter: 5
[java] Exception in thread "main" java.lang.NullPointerException
(with the rest of the stack trace as reported above)
thanks for any insight,
Chris Sarnowski