[jboss-user] [JBoss Seam] - Can action called from button avoid committing transaction?
tynor
do-not-reply at jboss.com
Fri Aug 24 16:35:45 EDT 2007
Seam 1.2.1-GA, JBoss AS 4.2.1, Hibernate 3.2.5ga
I wish to put a button on a form that adds an item to a list being displayed/edited in a dataTable. The new item is not completely initialized -- until the user types in some values in the table columns, it's not ready for persisting.
On my MyHome class, I have a function
| public void addItem() {
| getInstance().myList().add(new SomeEntity());
| }
|
The problem is that after calling addItem, something is deciding to commit the new SomeEntity to the database. I don't want it to try to persist until I explicitly call em.persist() or em.update(). How can I stop it from persisting the object?
I've tried several types of button markup:
| <s:button action="#{myHome.addItem}" ...
| <h:command action="#{myHome.addItem}" ...
| <h:commandButton immediate="true"action="#{myHome.addItem}" ...
|
... and no matter what I do, hibernate is deciding to commit a transaction when I call through the button. Help!
The stack in case that helps:
org.hibernate.PropertyValueException: not-null property references a null or transient value: my.package.SomeEntity.name
| at org.hibernate.engine.Nullability.checkNullability(Nullability.java:72)
| at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
| at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)
| at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)
| at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49)
| at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
| at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
| at org.hibernate.impl.SessionImpl.firePersistOnFlush(SessionImpl.java:644)
| at org.hibernate.impl.SessionImpl.persistOnFlush(SessionImpl.java:636)
| at org.hibernate.engine.CascadingAction$9.cascade(CascadingAction.java:323)
| at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
| at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
| at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
| at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
| at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
| at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
| at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
| at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
| at org.hibernate.event.def.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:456)
| at org.hibernate.event.def.DefaultPersistEventListener.entityIsPersistent(DefaultPersistEventListener.java:111)
| at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:84)
| at org.hibernate.impl.SessionImpl.firePersistOnFlush(SessionImpl.java:644)
| at org.hibernate.impl.SessionImpl.persistOnFlush(SessionImpl.java:636)
| at org.hibernate.engine.CascadingAction$9.cascade(CascadingAction.java:323)
| at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
| at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
| at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
| at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
| at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
| at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
| at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
| at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
| at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
| at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:122)
| at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
| at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
| at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
| at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
| at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:516)
| at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:114)
| at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:247)
| at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
| at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
| at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1382)
| at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
| at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
| at org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:140)
| at org.jboss.seam.jsf.AbstractSeamPhaseListener.commitOrRollback(AbstractSeamPhaseListener.java:324)
| at org.jboss.seam.jsf.TransactionalSeamPhaseListener.handleTransactionsAfterPageActions(TransactionalSeamPhaseListener.java:52)
| at org.jboss.seam.jsf.AbstractSeamPhaseListener.enterPage(AbstractSeamPhaseListener.java:285)
| at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:214)
| at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:56)
| at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
| at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.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(ApplicationFilterChain.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(SecurityAssociationValve.java:179)
| at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java: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(CachedConnectionValve.java:157)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| 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(Http11Protocol.java:580)
| at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
| at java.lang.Thread.run(Thread.java:595)
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077928#4077928
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077928
More information about the jboss-user
mailing list