-->
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.  [ 7 posts ] 
Author Message
 Post subject: what's the difference of jdbc and hibernate connection ?
PostPosted: Tue Jan 13, 2004 1:55 am 
Newbie

Joined: Mon Jan 12, 2004 6:26 am
Posts: 10
whe i use the connection which get from jdbc to call a procedure,it works well.but when i use the connection which get from Hibernate.getSession().connection(),it does't work.my code as follow:


CallableStatement cs;
try {

cs = connection.prepareCall("{call sp_zyjs_match(?,?,?,?)}");
cs.registerOutParameter(4, Types.VARCHAR);
cs.setInt(1,1);
cs.setString(2, "1000000000");
cs.setString(3,"admin");
cs.execute();
String outParam=cs.getString(4);
System.out.println("message = " + outParam);

......

the error is:

java.lang.NullPointerException
at oracle.jdbc.dbaccess.DBDataSetImpl._createOrGetDBItem(DBDataSetImpl.java:535)
at oracle.jdbc.dbaccess.DBDataSetImpl.setBytesBindItem(DBDataSetImpl.java:1642)
at oracle.jdbc.driver.OraclePreparedStatement.setItem(OraclePreparedStatement.java:745)
at oracle.jdbc.driver.OraclePreparedStatement.setString(OraclePreparedStatement.java:1083)
at OracleProdedure.callProcedure(OracleProdedure.java:91)
at OracleProdedure.main(OracleProdedure.java:121)


can anyone tell me why?? thanks!!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2004 5:14 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
There is no difference. Surely you are doing something different than in your working example. There is not even a Hibernate class involved in the stack trace!


Top
 Profile  
 
 Post subject: differnece between the hibernate and jdbc?
PostPosted: Tue Jan 13, 2004 5:46 am 
Newbie

Joined: Mon Jan 12, 2004 6:26 am
Posts: 10
but i use the sql such as :select * from table
it works well with the both connection.when i call the procedure,
with the jdbc connection it works well.but with the hibernate connection it evoke the error.i think it must be the connection problem,is it right?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2004 5:54 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
I am SURE you are not doing the same thing. Different database? Look at where the null pointer is thrown, this is directly in the driver code, there are no wrappers or hibernate classes involved on the way.


Top
 Profile  
 
 Post subject: procedure parameter
PostPosted: Tue Jan 13, 2004 6:03 am 
Newbie

Joined: Mon Jan 12, 2004 6:26 am
Posts: 10
but when i call the prodecure without parameter,the both connection works well.but when the parameter more than 3,the habernate connection evoke error.
can you tole me your mail.i will send my code to you .thanks!!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2004 6:05 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
That will not help, I have no Oracle to test. I tell you, this is NOT hibernates fault.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 13, 2004 6:09 am 
Newbie

Joined: Mon Jan 12, 2004 6:26 am
Posts: 10
but i run the same code,the only difference is the connection.one is get from jdbc.another is from hibernate.i am confused.
have you do the same thing as me and success?i said that have you use the hibernate connection to call the procedure?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.