[
https://jira.jboss.org/jira/browse/JBSEAM-3330?page=com.atlassian.jira.pl...
]
Dan Allen commented on JBSEAM-3330:
-----------------------------------
The correct solution is to use manual flushing on the conversation. If you put the
persistence context into manual flush mode, changes are not sent to the database until
flush() is called on the EntityManager. All of the write operations (persist, update,
delete) on the EntityHome class make a call to flush(), so there is no need for the
developer to worry about this step.
To activate manual flush mode, simply add the flush-mode attribute to begin conversation
directive in the *.page.xml file. I have made this change in Seam 2.1 for both the
RichFaces and ICEfaces projects.
<begin-conversation flush-mode="MANUAL"/>
Using manual flush mode in seam-gen is very important for two reasons.
1) Any partial submit was causing the record to be updated (in edit mode), so even if you
clicked cancel, the changes would have already taken affect.
2) Seam strongly advocates the use of manual flushing, almost to the point that not using
it is incorrect. Since only Hibernate supports manual flushing, other JPA providers are
broken in this regard.
You may wonder why the RichFaces example was working before without the use of manual
flushing. The reason is that the <a:support> tag has the feature of short-circuiting
the life cycle prior to the update model values phase, activated with the
bypassUpdates="true" attribute. The partial submit in ICEfaces does not perform
this short-circuit.
Technically, though, the behavior of ICEfaces is more semantically correct. Skipping the
update model values phase has other shortcomings, such as the inability to do cross-field
validation easily. Besides, when you navigate away from the form to select a parent
entity, that triggers a full JSF life cycle, causing the changes to be sent to the
database if you are not using manual flushing.
Here is the lesson. When using a conversation to manage an update operation (i.e., edit
mode) you should be using manual flushing. End of story.
ICEfaces edit page in seam-gen application updates without save
---------------------------------------------------------------
Key: JBSEAM-3330
URL:
https://jira.jboss.org/jira/browse/JBSEAM-3330
Project: Seam
Issue Type: Feature Request
Components: ICE Faces Integration, Tools
Affects Versions: 2.0.3.CR1
Environment: ICEfaces
Reporter: Valerie Griffin
Assignee: judy guglielmin
The generated code includes partial submit. Whenever a field is changed, the database is
updated without requiring the Save button.
I've reported this problem to ICEfaces. The fix they propose requires the use of
manual flush, which I understand is not universally supported. (The fix is to use manual
flush and to override update, persist, and remove to invoke the manual flush.)
I'm changing my seam-gen files to use that fix but am not including them here because
I don't think that's necessarily the best fix.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira