I'm testing my error-handling code.
When I purposely submit bad data, "transaction.commit()" throws "org.hibernate.exception.genericJDBCException". This is expected.
I re-submit the bad data. This time, NPE is thrown.
I re-submit the bad data. genericJDBCException is thrown.
I re-submit the bad data. NPE is thrown.
etc... as I repeatedly re-submit the bad data, the exception thrown alternates between genericJDBCException and NPE.
It seems obvious that something is not being properly re-set following each genericJDBCException occurrence, but what?
Psuedo-code:
try
{
Session s = factory.getSession();
s.clear();
Transaction tx = s.beginTransaction();
s.save(myObject);
tx.commit();
}
catch (Exception e)
{
e.printStackTrace();
tx.rollback();
}
finally
{
s.close();
}
The NPE stack trace:
java.lang.NullPointerException
[4/17/07 10:27:53:119 EDT] 41324132 SystemErr R at java.lang.Throwable.<init>(Throwable.java:52)
[4/17/07 10:27:53:119 EDT] 41324132 SystemErr R at java.lang.Throwable.<init>(Throwable.java:66)
[4/17/07 10:27:53:119 EDT] 41324132 SystemErr R at java.lang.NullPointerException.<init>(NullPointerException.java:63)
[4/17/07 10:27:53:119 EDT] 41324132 SystemErr R at oracle.jdbc.dbaccess.DBData.clearItem(DBData.java:431)
[4/17/07 10:27:53:119 EDT] 41324132 SystemErr R at oracle.jdbc.dbaccess.DBDataSetImpl.clearItem(DBDataSetImpl.java:3528)
[4/17/07 10:27:53:119 EDT] 41324132 SystemErr R at oracle.jdbc.driver.OraclePreparedStatement.clearParameters(OraclePreparedStatement.java:3401)
[4/17/07 10:27:53:119 EDT] 41324132 SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.resetStatement(WSJdbcConnection.java:1710)
[4/17/07 10:27:53:119 EDT] 41324132 SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:1405)
[4/17/07 10:27:53:119 EDT] 41324132 SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:1368)
[4/17/07 10:27:53:119 EDT] 41324132 SystemErr R at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:396)
[4/17/07 10:27:53:135 EDT] 41324132 SystemErr R at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:76)
[4/17/07 10:27:53:135 EDT] 41324132 SystemErr R at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:69)
[4/17/07 10:27:53:135 EDT] 41324132 SystemErr R at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:150)
[4/17/07 10:27:53:135 EDT] 41324132 SystemErr R at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1839)
[4/17/07 10:27:53:135 EDT] 41324132 SystemErr R at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2200)
[4/17/07 10:27:53:135 EDT] 41324132 SystemErr R at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46)
[4/17/07 10:27:53:135 EDT] 41324132 SystemErr R at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
[4/17/07 10:27:53:135 EDT] 41324132 SystemErr R at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
[4/17/07 10:27:53:135 EDT] 41324132 SystemErr R at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
[4/17/07 10:27:53:135 EDT] 41324132 SystemErr R at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
[4/17/07 10:27:53:135 EDT] 41324132 SystemErr R at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
[4/17/07 10:27:53:135 EDT] 41324132 SystemErr R at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:730)
[4/17/07 10:27:53:135 EDT] 41324132 SystemErr R at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:324)
[4/17/07 10:27:53:135 EDT] 41324132 SystemErr R at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
Thank you.
|