-->
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: apparent error in Hibernate 3.0 'eg' example, Oracle 9.2
PostPosted: Thu Mar 24, 2005 4:25 pm 
Newbie

Joined: Wed Mar 23, 2005 1:16 pm
Posts: 1
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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 07, 2005 9:59 am 
Newbie

Joined: Thu Apr 07, 2005 9:55 am
Posts: 2
Do you have use_sql_comments = true? If so, try setting it to false and see if that solves the problem.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 04, 2005 12:58 pm 
Newbie

Joined: Wed May 04, 2005 12:44 pm
Posts: 1
Location: Texas, U.S.A.
Chris,

I am following the road map for new users and have run into the exact same problem attempting to build the example. Were you ever able to resolve this with Hibernate 3.0?

Obviously, this error occurs regardless of the settings for show_sql and use_sql_comments. If anyone else has run into this and has a quick fix, please feel free to reply. Not a big deal since its only the sample, but it will be frustrating to new users who are trying this out with Oracle9i.

Regards,
-Ryan


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 11, 2005 1:30 pm 
Newbie

Joined: Wed May 11, 2005 12:48 pm
Posts: 1
This is a bug in the Oracle driver bundled with the Oracle 9i distribution. The solution is to download the latest version of the ojdbc14.jar from Oracle and use that instead. Using the latest version for 9i fixed the problem for me -- I also hear that the 10g release of the jar works as well (and is backwards compatible for 9i databases).

Note that you will have to make sure that use_sql_comments is set to false or you will have further efforts (with the updated 9i driver at least).

Cheers,
Eric


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.