[
http://opensource.atlassian.com/projects/hibernate/browse/HB-771?page=com...
]
Mark Müller commented on HB-771:
--------------------------------
If one has to stick to JDK 1.3 (like me) it may help to change the "Statement cache
size" to 0 for the Datasource in the Websphere console. At least this has helped me.
NullPointerException from oracle when flushing the session
----------------------------------------------------------
Key: HB-771
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HB-771
Project: Hibernate2
Type: Bug
Components: core
Versions: 2.1
Environment: hibernate 2.1, Oracle9i, WAS 5.1.0 JRE 1.4.1
Reporter: Hadi Mallah
Priority: Critical
Hi,
I just recently started using hibernate for my O/R mapping, after using Toplink for
sometime.
I have some issues and questions hopefully can be cleared out.
Facts/environment:
1- We've created a simple thin layer around hibernate for the developer to interface
with instead of going directly to hibernate APIs.
2- We are using Websphere studio 5.1.1 (WAS 5.1.0 and JRE 1.4.1)
3- hibernate 2.1
4- JTATransactionFactory, WebSphereTransactionManagerLookup,
DatasourceConnectionProvider, OracleDialect, TreeCacheProvider (JBoss)
5- Session façade -> CMT (transaction-type=Container)
6- oracle.jdbc.xa.client.OracleXADataSource, ojdbc14.jar
7- We keep the session in a ThreadLocal, to make sure we hold the session for the current
executing thread. We close the session when all work is completed. Since we depend on
WebSphere JTA Tranaction Manager, we don't explicitly commit or rollback. We open the
session, execute the action, flush, and then close the session - that all in the session
façade (CMT).
Issues:
- I have been testing hibernate with Websphere studio 5.1.0 (WAS 5.0 and JRE 1.3) before,
and it was working perfectly, then after I upgraded to Websphere studio 5.1.1 (WAS 5.1.0
and JRE 1.4.1), the problems started:
1- TransactionManagerFactory class package was changed in WAS
5.1. So basically it's as following:
WAS 4.0: c com.ibm.ejs.jts.jta.JTSXA
WAS 5.0: com.ibm.ejs.jts.jta.TransactionManagerFactory
WAS 5.1: com.ibm.ws.Transaction.TransactionManagerFactory
So I had to apply the change in
net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
I realized now that other people fixed it in this forum. so skip this one.
2- A strange problem has started, the first instance of an
operation regardless if it is create, update, or delete works
fine, then I the second time I try to do another create, update
or delete, and when I try to flush the session, I get an oracle
NullPointerException:
java.lang.NullPointerException
at oracle.jdbc.dbaccess.DBData.clearItem(DBData.java:431)
at oracle.jdbc.dbaccess.DBDataSetImpl.clearItem(DBDataSetImpl.java:3528)
at
oracle.jdbc.driver.OraclePreparedStatement.clearParameters(OraclePreparedStatement.java:3401)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.resetStatement(WSJdbcConnection.java:1719)
at
com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:1415)
at
com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.prepareStatement(WSJdbcConnection.java:1381)
at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:230)
at net.sf.hibernate.impl.BatcherImpl.prepareStatement(BatcherImpl.java:57)
at net.sf.hibernate.impl.BatcherImpl.prepareBatchStatement(BatcherImpl.java:105)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:461)
at net.sf.hibernate.persister.EntityPersister.insert(EntityPersister.java:443)
at net.sf.hibernate.impl.ScheduledInsertion.execute(ScheduledInsertion.java:29)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2308)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2261)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2187)
I go around this problem by catching the exception, clearing the
session, and trying again, then it works fine the second time.
I'm not sure, if the problem is a threading issues or what? What
I know is I don't want it to be solved this way, although it is
apparently not affecting the performance that much.
Keep in mind that the same code works fine with the previous
environment WAS 5.0 and JRE 1.3.
And it happens either if I set transaction.manager_lookup_class
to WebSphereTransactionManagerLookup or not.
- It seems that after I do a session flush, data gets commited, if I fire a
RuntimeException after flushing Websphere JTA Tranaction Manager doesn't rollback. Do
I have to call rollback my self, am I allowed to rollback if Websphere JTA Tranaction
Manager is demecrating the tranasctions, then whats the purpose of using Websphere JTA
Tranaction Manager?
Thanks,
Hadi
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira