Bug 860916

Summary: Error when creating new Topic
Product: [Community] PressGang CCMS Reporter: Lee Newson <lnewson>
Component: Web-UIAssignee: pressgang-ccms-dev
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.0CC: rlandman
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-01 23:54:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lee Newson 2012-09-27 05:36:02 UTC
Misty got the angry terminator today.

Here is the main part of the exception:


Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: com.redhat.topicindex.entity.TopicSecondOrderData
        at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:243) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.type.EntityType.getIdentifier(EntityType.java:456) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:265) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:275) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.type.TypeHelper.findDirty(TypeHelper.java:295) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:3403) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.event.def.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:358) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:287) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:155) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:58) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:1185) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1261) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.envers.query.impl.AbstractAuditQuery.buildAndExecuteQuery(AbstractAuditQuery.java:98) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.envers.query.impl.RevisionsOfEntityQuery.list(RevisionsOfEntityQuery.java:113) [hibernate3.jar:3.6.8.Final]
        at org.hibernate.envers.query.impl.AbstractAuditQuery.getSingleResult(AbstractAuditQuery.java:108) [hibernate3.jar:3.6.8.Final]
        at com.redhat.topicindex.session.VersionedEntityHome.update(VersionedEntityHome.java:76) [classes:]
        at com.redhat.topicindex.session.TopicHome.update(TopicHome.java:447) [classes:]
        at com.redhat.topicindex.session.TopicHome.updateAndStay(TopicHome.java:461) [classes:]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.7.0_03]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.7.0_03]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.7.0_03]
        at java.lang.reflect.Method.invoke(Method.java:601) [:1.7.0_03]
        at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) [jboss-seam.jar:]
        at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) [jboss-seam.jar:]
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) [jboss-seam.jar:]
        at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) [jboss-seam.jar:]
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:]
        at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77) [jboss-seam.jar:]
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:]
        at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:97) [jboss-seam.jar:]
        at org.jboss.seam.util.Work.workInTransaction(Work.java:61) [jboss-seam.jar:]
        at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91) [jboss-seam.jar:]
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:]
        at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) [jboss-seam.jar:]
        at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) [jboss-seam.jar:]
        at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) [jboss-seam.jar:]
        at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) [jboss-seam.jar:]
        at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) [jboss-seam.jar:]
        at com.redhat.topicindex.session.TopicHome_$$_javassist_seam_25.updateAndStay(TopicHome_$$_javassist_seam_25.java) [classes:]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.7.0_03]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [:1.7.0_03]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.7.0_03]
        at java.lang.reflect.Method.invoke(Method.java:601) [:1.7.0_03]
        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335) [jboss-el.jar:]
        at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348) [jboss-el.jar:]
        at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58) [jboss-el.jar:]
        at org.jboss.el.parser.AstValue.invoke(AstValue.java:96) [jboss-el.jar:]
        at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276) [jboss-el.jar:]
        at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68) [jsf-facelets.jar:]
        at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88) [jsf-api-1.2_13.jar:1.2_13-b01-FCS]
        ... 48 more

Comment 1 Lee Newson 2012-10-09 05:03:17 UTC
*** Bug 861259 has been marked as a duplicate of this bug. ***

Comment 2 Lee Newson 2012-10-10 23:14:10 UTC
Fixed in Build 20121011-0758.

Cause:

The validateXML() method was creating a TopicSecondOrderData entity when one didn't exist during the Pre Persist/Update phase and as such the cascade had already been processed at this stage and the TopicSecondOrderData entity wasn't getting persisted causing the above exception.

Consequence:

Any topics that didn't have a TopicSecondOrderData entity associated with a topic would cause the above exception and weren't able to be edited.

Fix:

Move the validation process to just before the topic is persisted. Doing this ensures that the TopicSecondOrderData will be processed and persisted properly.