• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NullPointerException when trying to run the Hibernate Example

 
Kumar Hanu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am new to Hibernate. I downloaded the hibernate 3.0.5 and followed the steps to run the example that comes with the hibernate installation. I configured the example to run for Oracle 9i database. When I try to run the example by typing "build eg" I get NullPointerException when it tries to create the Sample test Data. I could see that I am able to connect to oracle coz the application created the tables in the Database. Any help regarding this issue is highly appreciated.

Thanks

The following is the stack trace.

[java] 16:50:49,109 INFO SessionFactoryImpl:379 - Checking 0 named queries
[java] Setting up some test data
[java] 16:50:49,156 INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jdbc racle:thin:@localhost:1521:KUMAR
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] Before Commit
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] Hibernate: select hibernate_sequence.nextval from dual
[java] Hibernate: /* insert org.hibernate.auction.User */ insert into AuctionUser (userName, "password", email, firstName, "initial", lastName, id) val
ues (?, ?, ?, ?, ?, ?, ?)
[java] Hibernate: /* insert org.hibernate.auction.User */ insert into AuctionUser (userName, "password", email, firstName, "initial", lastName, id) val
ues (?, ?, ?, ?, ?, ?, ?)
[java] Hibernate: /* insert org.hibernate.auction.User */ insert into AuctionUser (userName, "password", email, firstName, "initial", lastName, id) val
ues (?, ?, ?, ?, ?, ?, ?)
[java] 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.setNull(OraclePreparedStatement.java:1322)
[java] at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:55)
[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:1617)
[java] at org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1594)
[java] at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1850)
[java] at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2200)
[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:730)
[java] at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
[java] at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
[java] at org.hibernate.auction.Main.createTestAuctions(Main.java:367)
[java] at org.hibernate.auction.Main.main(Main.java:389)
[java] Exception in thread "main"

BUILD FAILED
C:\hibernate-3.0.5\hibernate-3.0\build.xml:619: Java returned: 1

Total time: 26 seconds
 
tb luong
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kumar,

Please use the latest oracle driver ojdbc14.jar for Oracle 9i. Then, update your build.xml.

It worked for me.


tbluong.
 
Kumar Hanu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi tb,

Thanks a lot for your suggestion. It worked great!
 
Nagsen Dahat
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am using Helbertic Framework for my project but
getting following error.

using Oracle-8.1.7
unix (Solaris) plateform
SUN One Application Server (Portal)
TableDetails are attached.

I tried using 'classes12.jar' and 'ojdbc14.jar'
separately in the classpath, but still getting
following exception :::


java.lang.NullPointerException
at
oracle.jdbc.driver.OraclePreparedStatement.checkBindTypes(OraclePreparedStatement.java:2389)
at
oracle.jdbc.driver.OraclePreparedStatement.setItem(OraclePreparedStatement.java:760)
at
oracle.jdbc.driver.OraclePreparedStatement.setString(OraclePreparedStatement.java:1136)
at
COM.hilbertinc.rdbms.HDescriptorCommand.setString(HDescriptorCommand.java:808)
at
COM.hilbertinc.rdbms.HDescriptorCommandSet.apply(HDescriptorCommandSet.java:166)
at
COM.hilbertinc.rdbms.HSqlDescriptorForPrepared.run(HSqlDescriptorForPrepared.java:406)
at
COM.hilbertinc.rdbms.HSqlTransaction.runDescriptors(HSqlTransaction.java:643)
at
COM.hilbertinc.rdbms.HSqlTransaction.run(HSqlTransaction.java:581)
at
COM.hilbertinc.rdbms.HConnectionThread.run(HConnectionThread.java:162)
at
COM.hilbertinc.threadpool.HThreadPoolThread.runPoolRequest(HThreadPoolThread.java:112)
at
COM.hilbertinc.threadpool.HThreadPoolThread.run(HThreadPoolThread.java:274)

08/09/2005 01:14:24:772 PM CDT:
Thread[Thread-161,5,main]
ERROR: Error Occured inside update Poll Results Method
::::
COM.hilbertinc.base.HException: Exception ocurred
running prepared statement
at
COM.hilbertinc.rdbms.HSqlDescriptorForPrepared.run(HSqlDescriptorForPrepared.java:432)
at
COM.hilbertinc.rdbms.HSqlTransaction.runDescriptors(HSqlTransaction.java:643)
at
COM.hilbertinc.rdbms.HSqlTransaction.run(HSqlTransaction.java:581)
at
COM.hilbertinc.rdbms.HConnectionThread.run(HConnectionThread.java:162)
at
COM.hilbertinc.threadpool.HThreadPoolThread.runPoolRequest(HThreadPoolThread.java:112)
at
COM.hilbertinc.threadpool.HThreadPoolThread.run(HThreadPoolThread.java:274)


I am trying to RUN the following code.
trans = new HSqlTransaction();
String storedProcedureSQL = "{call
UPD_POLL_QUICK(?,?,?)}";
hsdfCallable = trans.callable(storedProcedureSQL);
hsdfCallable.setString(1,newPollOptions.toString());
hsdfCallable.setString(2,dcr_pathStr);
hsdfCallable.setString(3,userADID);
pool.run(trans);


and the code fails at "pool.run(trans);" statement.



Following is the stored procedure code which is being
executed...............

CREATE OR REPLACE PROCEDURE
UPD_POLL_QUICK(M_PD_POLL_OPTIONS IN VARCHAR2,
M_DIRPATH IN VARCHAR2, M_UQD_USERID IN VARCHAR2)
AS
M_UQD_POLL_ID NUMBER;
M_VOTES NUMBER;
BEGIN


SELECT PD_POLL_ID, PD_NO_OF_VOTES INTO
M_UQD_POLL_ID, M_VOTES FROM POLL_DETAILS WHERE
DCR_PATH = M_DIRPATH;

UPDATE
POLL_DETAILS
SET
PD_NO_OF_VOTES = M_VOTES+1,
PD_POLL_OPTIONS = M_PD_POLL_OPTIONS
WHERE
DCR_PATH = M_DIRPATH;


INSERT INTO
USER_QUICKPOLL_DETAILS(UQD_POLL_ID,UQD_USER_ID,UQD_POLL_DATE)
VALUES(M_UQD_POLL_ID, M_UQD_USERID, SYSDATE);

COMMIT;
END;
/





Please let me know if there is any resolution to this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic