[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2604?page=c...
]
Tushar Pokle commented on HHH-2604:
-----------------------------------
I believe this is the same problem that the following poster encountered:
http://mail-archives.apache.org/mod_mbox/db-derby-user/200603.mbox/%3C031...
From acemcclou...(a)comcast.net
Subject Null Pointer Exception
Date Fri, 10 Mar 2006 16:21:21 GMT
I am getting the stack trace shown below. Could someone provide a clue as to what I'm
doing
wrong?
Thank you,
Ace
-----------------------------------------------------------------------------------------
java.lang.NullPointerException
at org.hibernate.jdbc.AbstractBatcher.closeConnection(AbstractBatcher.java:462)
at
org.hibernate.engine.TransactionHelper.doWorkInNewTransaction(TransactionHelper.java:128)
at org.hibernate.id.TableGenerator.generate(TableGenerator.java:94)
at org.hibernate.id.TableHiLoGenerator.generate(TableHiLoGenerator.java:61)
at
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:85)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:184)
at
org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:173)
at
org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:481)
at org.hibernate.impl.SessionImpl.save(SessionImpl.java:476)
at <some code of mine that calls save with an object>
Isolator.JdbcDelegate masks the exception if it isn't possible to
open a connection.
------------------------------------------------------------------------------------
Key: HHH-2604
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2604
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.4
Environment: Hibernate 3.2.2ga
Reporter: Tushar Pokle
Priority: Minor
A defect in Isolator.JdbcDelegate makes it throw the wrong exception - a
NullPointerException - that masks the true exception. In my case it was an
UnsupportedOperationException("The user must supply a JDBC connection").
The trouble is at the start of Isolator.JdbcDelegate.delegateWork(...):
{code}
174 public void delegateWork(IsolatedWork work, boolean transacted) throws
HibernateException {
175 Connection connection = null;
176 boolean wasAutoCommit = false;
177 try {
178 connection = session.getBatcher().openConnection();
{code}
If there is a failure opening a connection on line 178, the finally clause is executed.
The finally clause needs the connection, which of course is null :-)
--
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