-
1. Re: save the transient instance before flushing
christian.bauer Jul 25, 2007 8:24 AM (in response to odupont)Well, looks like the persistence context is flushed before you execute that query, because the query touches entities that have been modified. Either enable cascading persist on the association from Category to Application (I'm guessing here that this is the association in question), or call persist() on the Category instance before flushing/querying, or disable automatic flushing with FlushModeType.MANUAL by using a Seam-managed persistence context.
-
2. Re: save the transient instance before flushing
squ1rr3l Aug 14, 2007 4:15 PM (in response to odupont)I'm getting a similar error, and as a SEAM newbie, I can't figure out how to fix it.
I used seam-gen to create a new project, then used new-entity. The resulting components allow me to create and edit, but the "delete" button produces the TransientObjectException:16:08:25,384 ERROR [ExceptionFilter] exception root cause javax.faces.FacesException: #{commentHome.remove}: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flus hing: gov.virginia.vec.IT.prov.Comment at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.j ava:107) at javax.faces.component.UICommand.broadcast(UICommand.java:383) at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180) at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158) at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:3 46) at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.j ava:97) at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil terChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain .java:206) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:82) at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:68) at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:68) at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:68) at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:68) at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.j ava:127) at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277) at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:68) at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:68) at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:149) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil terChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain .java:206) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java: 96) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil terChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain .java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java: 175) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociati onValve.java:179) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.ja va:433) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionV alve.java:157) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:10 9) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11P rotocol.java:580) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:595) Caused by: javax.faces.el.EvaluationException: org.hibernate.TransientObjectException: obj ect references an unsaved transient instance - save the transient instance before flushing : gov.virginia.vec.IT.prov.Comment at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBinding MethodExpressionAdapter.java:91) at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.j ava:91) ... 45 more
-
3. Re: save the transient instance before flushing
squ1rr3l Aug 17, 2007 3:59 PM (in response to odupont)Ok, is this a problem in the CVS version of org.jboss.seam.framework.EntityHome, or is it just me?
In the seam-gen created [entity]Home.java class, if I do this:log.info("Entity name: " + super.getEntityName()); log.info("persist result: " + super.persist()); log.info("remove result: " + super.remove());
I get the correct entity name, "persisted" is returned from the persist method, but then the above-reference exception when it gets to the remove().
I don't see any Hibernate commands on the log when calling persist, so maybe that is not working? The "Hibernate: delete ... " is written right before the exception. -
4. Re: save the transient instance before flushing
christian.bauer Aug 18, 2007 8:48 AM (in response to odupont)This was caused by getEntityName() in EntityHome and has been fixed in CVS.