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!!
|