-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: <version> field and it's role in TransientObjectExcept
PostPosted: Wed Feb 07, 2007 12:15 am 
Newbie

Joined: Fri Jan 26, 2007 10:13 pm
Posts: 9
Hibernate version: 3.2.2 GA

Full stack trace of any exception that occurs:
[2/5/07 15:04:12:450 IST] 00000036 ExceptionUtil E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "calculateAgreement" on bean "BeanId(RUBY_EAR#UnderwritingEJB.jar#UnderwritingFacade, null)". Exception data: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.generali.ruby.bo.AbstractRolesBO

at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:219)

at org.hibernate.type.EntityType.getIdentifier(EntityType.java:397)

at org.hibernate.type.EntityType.replace(EntityType.java:253)

at org.hibernate.type.AbstractType.replace(AbstractType.java:153)

at org.hibernate.type.TypeFactory.replace(TypeFactory.java:495)

at org.hibernate.event.def.DefaultMergeEventListener.copyValues(DefaultMergeEventListener.java:377)

at org.hibernate.event.def.DefaultMergeEventListener.entityIsTransient(DefaultMergeEventListener.java:179)

at com.generali.ruby.utils.persistance.RubyMergeEventListener.entityIsTransient(RubyMergeEventListener.java:799)

at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:123)

at com.generali.ruby.utils.persistance.RubyMergeEventListener.onMerge(RubyMergeEventListener.java:76)

at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:687)

at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:669)

at org.hibernate.engine.CascadingAction$6.cascade(CascadingAction.java:245)

at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java(Inlined Compiled Code))

at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java(Compiled Code))

at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java(Compiled Code))

at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java(Compiled Code))

at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java(Compiled Code))

at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java(Compiled Code))

at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java(Compiled Code))

at org.hibernate.engine.Cascade.cascade(Cascade.java(Compiled Code))

at org.hibernate.event.def.DefaultMergeEventListener.cascadeOnMerge(DefaultMergeEventListener.java:407)

at org.hibernate.event.def.DefaultMergeEventListener.entityIsPersistent(DefaultMergeEventListener.java:152)

at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:126)

at com.generali.ruby.utils.persistance.RubyMergeEventListener.onMerge(RubyMergeEventListener.java:76)

at org.hibernate.event.def.DefaultMergeEventListener.onMerge(DefaultMergeEventListener.java:53)

at org.hibernate.impl.SessionImpl.fireMerge(SessionImpl.java:677)

at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:661)

at org.hibernate.impl.SessionImpl.merge(SessionImpl.java:665)

at com.generali.ruby.bo.BusinessObject.merge(BusinessObject.java:96)

at com.generali.ruby.services.underwriting.UnderwritingFacadeBean.calculateAgreement(UnderwritingFacadeBean.java:8349)

at com.generali.ruby.services.underwriting.EJSRemoteStatelessUnderwritingFacade_84e0e0cf.calculateAgreement(EJSRemoteStatelessUnderwritingFacade_84e0e0cf.java:2043)

at com.generali.ruby.services.underwriting._UnderwritingFacade_Stub.calculateAgreement(_UnderwritingFacade_Stub.java:2814)

at com.generali.ruby.delegate.underwriting.UnderwritingBD.calculateAgreement(UnderwritingBD.java:1178)

at com.generali.ruby.ui.underwriting.newapplication.action.CalculateAgreementAction.calculateAgreement(CalculateAgreementAction.java:145)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))

at java.lang.reflect.Method.invoke(Method.java(Compiled Code))

at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)

at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)

at com.generali.ruby.base.action.RUBYBaseDispatchAction.execute(RUBYBaseDispatchAction.java:179)

at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:480)

at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)

at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420)

at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:520)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1173)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:69)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:626)

at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:250)

at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1058)

at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:269)

at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:451)

at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:312)

at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:401)

at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)

at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420)

at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:520)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1173)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)

at com.generali.ruby.filters.WorkFlowFilter.doFilter(WorkFlowFilter.java:83)

at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:77)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:626)

at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:80)

at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1657)

at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)

at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:94)

at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)

at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)

at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)

at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)

at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))

Name and version of the database you are using: Db2 7.2.5

I was consistently getting the above exception. Then, I after going through a few posts I changed the version property field of my class from

protected Integer version = null;
to
protected Integer version = new Integer(1);

and I stopped getting the TransientObjectException and Instead got another exception: NonUniqueObjectExection.

Exception Stack Trace :
[2/6/07 17:55:24:759 IST] 00000034 ExceptionUtil E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "calculateAgreement" on bean "BeanId(RUBY_EAR#UnderwritingEJB.jar#UnderwritingFacade, null)". Exception data: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.generali.ruby.bo.poa.PoaVTGRoleInfoItemBO#1m#!!;"!]

at org.hibernate.engine.StatefulPersistenceContext.checkUniqueness(StatefulPersistenceContext.java:577)

at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:284)

at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:223)

at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:89)

at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)

at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java(Compiled Code))

at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)

at org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:218)

at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java(Inlined Compiled Code))

at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java(Compiled Code))

at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java(Compiled Code))

at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java(Compiled Code))

at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java(Compiled Code))

at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java(Compiled Code))

at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java(Compiled Code))

at org.hibernate.engine.Cascade.cascade(Cascade.java(Compiled Code))

at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java(Compiled Code))

at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java(Compiled Code))

at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)

at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:35)

at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)

at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)

at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)

at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811)

at com.generali.ruby.bo.RenewalPeriodBO.fetchNextRenewalPeriod(RenewalPeriodBO.java:181)

at com.generali.ruby.bo.ExpectedPremiumPartBO.calculatePremiumPart(ExpectedPremiumPartBO.java:2284)

at com.generali.ruby.bo.PolicyBO.calculateAgreement(PolicyBO.java:12711)

at com.generali.ruby.services.underwriting.UnderwritingFacadeBean.calculateAgreement(UnderwritingFacadeBean.java:8500)

at com.generali.ruby.services.underwriting.EJSRemoteStatelessUnderwritingFacade_84e0e0cf.calculateAgreement(EJSRemoteStatelessUnderwritingFacade_84e0e0cf.java:2043)

at com.generali.ruby.services.underwriting._UnderwritingFacade_Stub.calculateAgreement(_UnderwritingFacade_Stub.java:2814)

at com.generali.ruby.delegate.underwriting.UnderwritingBD.calculateAgreement(UnderwritingBD.java:1178)

at com.generali.ruby.ui.underwriting.newapplication.action.CalculateAgreementAction.calculateAgreement(CalculateAgreementAction.java:145)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java(Compiled Code))

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))

at java.lang.reflect.Method.invoke(Method.java(Compiled Code))

at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)

at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)

at com.generali.ruby.base.action.RUBYBaseDispatchAction.execute(RUBYBaseDispatchAction.java:179)

at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:480)

at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)

at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420)

at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:520)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1173)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:69)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:626)

at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:250)

at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1058)

at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:269)

at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:451)

at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:312)

at org.apache.struts.action.RequestProcessor.processActionForward(RequestProcessor.java:401)

at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)

at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1420)

at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:520)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1173)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)

at com.generali.ruby.filters.WorkFlowFilter.doFilter(WorkFlowFilter.java:83)

at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:142)

at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:77)

at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:626)

at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:80)

at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1657)

at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)

at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)

at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:94)

at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)

at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)

at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)

at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)

at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))

Are these related in any way?

In this context I want to know,



1. Is this change correct? Should we continue using it?
2. Is the second error a consequence of this change?
3. Is there any other major implication of using this? How will other parts of the application get affected due to this change?


Please advise

Thanks,
Hitesh


Top
 Profile  
 
 Post subject: trying to answer your question.
PostPosted: Wed Feb 07, 2007 4:02 am 
Beginner
Beginner

Joined: Wed Nov 15, 2006 4:25 am
Posts: 21
Hai

I am trying to guess where your problem occured.

1) The First Exception says that you are trying to save an object into the database without calling session.save(Object), also you are some where trying to flush the Hibernate session after closing it or before .Try to not to flush and check it.

2) The second Exception was reveled after u have done something.The meaning of the secon exception is the object you are trying to save has an Identity value(in java jargon it is object memory value and in database jargon it is the PK value in the table) is already in the table with a different record.You are trying to insert with the same PK value.Please check the table in yuor data base .


Please reply me how much this has helped you


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 08, 2008 12:28 am 
Newbie

Joined: Thu Jan 03, 2008 7:21 pm
Posts: 15
Hi shantha,

I am sure your two answers are not to the point.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.