NullPointer thrown when session.flush() is called after update()
Hibernate version:
2.1.6
Mapping documents:
<class name="uk.org.ofcom.tnr.vo.TradeNotification"
table="TRADE_NOTIFICATIONS"
select-before-update="true"
>
<meta attribute="implements">uk.org.ofcom.hibernate.IAuditable</meta>
<id column="TN_ID" name="tnId" type="int">
<generator class="native">
<param name="sequence">TNR_OWNER.TN_ID_SEQ</param>
</generator>
</id>
<property column="TRANSFER_DETAILS"
length="500"
name="transferDetails"
not-null="true"
type="java.lang.String"/>
<property column="INTERNAL_COMMENTS"
length="500"
name="internalComments"
type="java.lang.String"/>
<property column="APPLICATION_RECEIVED"
length="7"
name="applicationReceived"
not-null="true"
type="java.util.Date"/>
<property column="TRANSFER_DATE"
length="7"
name="transferDate"
type="java.util.Date"/>
<property column="SELLER_LIC_NO"
name="sellerLicNo"
not-null="true"
type="java.lang.Integer"/>
<property column="BUYER_LIC_NO"
name="buyerLicNo"
not-null="false"
type="java.lang.Integer"/>
<property column="BUYER_CUS_REF"
length="12"
name="buyerCusRef"
type="java.lang.String"/>
<!-- uni-directional many-to-one association to TN_STATUS -->
<many-to-one
name="status"
class="uk.org.ofcom.tnr.vo.TnStatus"
cascade="none"
not-null="true"
insert="true"
update="true"
>
<column name="STATUS" />
</many-to-one>
<set name="history"
lazy="true"
inverse="true"
cascade="all">
<key column="TN_ID" />
<one-to-many class="uk.org.ofcom.tnr.vo.TnHistory"/>
</set>
</class>
Code between sessionFactory.openSession() and session.close():
session.update(vo);
session.flush();
Full stack trace of any exception that occurs:
java.lang.NullPointerException
at net.sf.hibernate.persister.AbstractEntityPersister.getCurrentPersistentState(AbstractEntityPersister.java:1249)
at net.sf.hibernate.impl.SessionImpl.flushEntity(SessionImpl.java:2475)
at net.sf.hibernate.impl.SessionImpl.flushEntities(SessionImpl.java:2422)
at net.sf.hibernate.impl.SessionImpl.flushEverything(SessionImpl.java:2224)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2203)
at uk.org.ofcom.tnr.dao.TradeNotificationDAO.updateTradeNotification(TradeNotificationDAO.java:140)
at uk.org.ofcom.tnr.delegates.TradeNotificationDelegate.updateTradeNotification(TradeNotificationDelegate.java:118)
at uk.org.ofcom.tnr.presentation.actions.TradeNotificationAction.execute(TradeNotificationAction.java:111)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:721)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:479)
Name and version of the database you are using:
Oracle 9i
The generated SQL (show_sql=true):
select TN_ID, TRANSFER_DETAILS as TRANSFER2_, INTERNAL_COMMENTS as INTERNAL3_, APPLICATION_RECEIVED as APPLICAT4_, TRANSFER_DATE as TRANSFER5_, SELLER_LIC_NO as SELLER_L6_, BUYER_LIC_NO as BUYER_LI7_, BUYER_CUS_REF as BUYER_CU8_, STATUS from TRADE_NOTIFICATIONS where TN_ID =?
Debug level Hibernate log excerpt:
2004-09-28 15:06:32,604 [HttpRequestHandler-2257397] DEBUG net.sf.hibernate.impl.SessionImpl - Flushing entities and processing referenced collections
2004-09-28 15:06:32,610 [HttpRequestHandler-2257397] DEBUG net.sf.hibernate.persister.AbstractEntityPersister - Getting current persistent state for: [uk.org.ofcom.tnr.vo.TradeNotification#18]
2004-09-28 15:06:32,611 [HttpRequestHandler-2257397] DEBUG net.sf.hibernate.impl.BatcherImpl - about to open: 0 open PreparedStatements, 0 open ResultSets
2004-09-28 15:06:32,612 [HttpRequestHandler-2257397] DEBUG net.sf.hibernate.SQL - select TN_ID, TRANSFER_DETAILS as TRANSFER2_, INTERNAL_COMMENTS as INTERNAL3_, APPLICATION_RECEIVED as APPLICAT4_, TRANSFER_DATE as TRANSFER5_, SELLER_LIC_NO as SELLER_L6_, BUYER_LIC_NO as BUYER_LI7_, BUYER_CUS_REF as BUYER_CU8_, STATUS from TRADE_NOTIFICATIONS where TN_ID =?
2004-09-28 15:06:32,614 [HttpRequestHandler-2257397] DEBUG net.sf.hibernate.impl.BatcherImpl - preparing statement
2004-09-28 15:06:32,615 [HttpRequestHandler-2257397] DEBUG net.sf.hibernate.type.IntegerType - binding '18' to parameter: 1
2004-09-28 15:06:32,617 [HttpRequestHandler-2257397] DEBUG net.sf.hibernate.impl.BatcherImpl - done closing: 0 open PreparedStatements, 0 open ResultSets
2004-09-28 15:06:32,619 [HttpRequestHandler-2257397] DEBUG net.sf.hibernate.impl.BatcherImpl - closing statement
2004-09-28 15:06:32,620 [HttpRequestHandler-2257397] DEBUG net.sf.hibernate.impl.SessionImpl - closing session
2004-09-28 15:06:32,621 [HttpRequestHandler-2257397] DEBUG net.sf.hibernate.impl.SessionImpl - disconnecting session
2004-09-28 15:06:32,621 [HttpRequestHandler-2257397] DEBUG net.sf.hibernate.impl.SessionImpl - transaction completion
2004-09-28 15:07:39,897 [Finalizer] DEBUG net.sf.hibernate.impl.SessionImpl - running Session.finalize()
|