-
1. Re: Values are persisted without calling EntityManager.persist
lvdberg Aug 17, 2009 12:25 PM (in response to ralf)A bit difficult to answer without the page which contains your cancel button, but I suspect you are using ajax to validate and you should disable updating the database there by setting the bypassUpdates attribute to true. So possibly it has nothing to do with the cancel-button, because the values are already updated.
-
2. Re: Values are persisted without calling EntityManager.persist
ralf Aug 17, 2009 12:43 PM (in response to ralf)Hi,
thank you for your fast reply.
Sure, i have some AJAX actions (e.g. validation), but the Cancel-Button is a normal h:commandButton.
I will try the ByPassUpdate attribute...
But nevertheless, i think the main problem is the Tab-Switch. On a switch, all values from the current Tab are submitted AND this will cause an update of the values in the
Event
object in the Conversational-BeanEventHandler
.How to handle this?! :)
-
3. Re: Values are persisted without calling EntityManager.persist
lvdberg Aug 17, 2009 12:51 PM (in response to ralf)try the bypassUpdates. The tab-panel shouldn't submit just because you change the tab (would be a very tricky application)
-
4. Re: Values are persisted without calling EntityManager.persist
ralf Aug 17, 2009 1:34 PM (in response to ralf)i think we probably dont discuss the same subject...
i mean the rich:tabpanelthere the values are submitted :)
-
5. Re: Values are persisted without calling EntityManager.persist
ralf Aug 17, 2009 1:42 PM (in response to ralf)I tried to edit only one value, which is just a h:inputtext and after a rich:tab-switch the values are persisted.
Is there a way, where i can say EntityManagaer.startTransaction and EntityManagaer.rollback/commit.
I know, that i can use an other Transaction Manager and probably this will work, but in my opinion i break the Seam/EntityManager concept... -
6. Re: Values are persisted without calling EntityManager.persist
lvdberg Aug 17, 2009 1:51 PM (in response to ralf)Hi Ralf,
We are talking about the same rich:tabpanel. I use it with a single entity split over different tabs and it doesn't produce a persiste or update when I swith the tabs. I use a ajax-switchtype and ajax for validate and submit. Works fine for me. Send the relevant part of the tab to see if there is something strange happening.
-
7. Re: Values are persisted without calling EntityManager.persist
ralf Aug 17, 2009 1:59 PM (in response to ralf)I will shorten the page a little bit ...
I just have an idea, ... the h:form is the
parent
of the rich:tabpanel. Maybe this causes the problem?!@Out( required = false ) private Event currentEvent;
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j" template="layout/div/hauptseite.xhtml" > <ui:param name="wobinich" value="Eventmanager" /> <ui:define name="inhalt"> <h:form id="eventform" enctype="multipart/form-data"> <h:messages globalOnly="false" styleClass="message"/> <rich:tabPanel switchType="ajax" > <rich:tab label="Event"> <s:validateAll> <h:inputText id="dfResult" value="#{currentEvent.name}" /> </s:validateAll> </rich:tab> <rich:tab label="Details"> <s:validateAll> <h:inputText id="anotherField" value="#{currentEvent.costs}" /> </s:validateAll> </rich:tab> </rich:tabPanel> </h:form> </ui:define> </ui:composition>
-
8. Re: Values are persisted without calling EntityManager.persist
ralf Aug 17, 2009 2:05 PM (in response to ralf)I made a form in every tab, now i have the problem, that i loose changed information on a tab-switch... ARGH!
-
9. Re: Values are persisted without calling EntityManager.persist
lvdberg Aug 17, 2009 2:50 PM (in response to ralf)Your validate-all tag is probably the cause. To validate, your model has the new inserted values. Place the tabpanel as a whole between the form tags and make sure you don't have nested form-tags (form in a form).
-
10. Re: Values are persisted without calling EntityManager.persist
ralf Aug 17, 2009 5:46 PM (in response to ralf)It doesnt work...
I removed all s:validate tags and made just one form... on tab-switch, the values are persisted.
I am thinking about a long-running-transaction...