-
15. Re: how can I do optimistic locking with crud framework?
gavin.king Oct 19, 2006 8:07 PM (in response to cja987)Actually change it to:
@Begin public void beginEdit() { log.info("Conversation begun by beginEdit()"); }
(This is more elegant.) -
16. Re: how can I do optimistic locking with crud framework?
gavin.king Oct 19, 2006 8:11 PM (in response to cja987)I have just tested this and it all works.
All I did was:
(1) Added a version attribute
(2) set scope="conversation" on contactHome (actually I will make this the default scope for a Home)
(3) put propagation="begin" on the Edit link. -
17. Re: how can I do optimistic locking with crud framework?
gavin.king Oct 19, 2006 8:15 PM (in response to cja987)(4) put propagation="end" on all links in editContact.xhtml
-
18. Re: how can I do optimistic locking with crud framework?
cja987 Oct 19, 2006 8:26 PM (in response to cja987)Aha, that did it, and I get ... yay, an HTTP 500 .. but the right error on the console. I guess dealing gracefully with the exception means catching it in update() and company. Figuring out how to present a UI to merge changes should be an interesting project.
I can't see anything in @Begin's javadoc that tells me about return values, and I assumed page actions had to return either null to proceed to the given view-id, or optionally return a new viewid. Should I should use s:commandLink if I need to defer to a page action instead? I'll eventually move my complex navigation requirements into jbpm, but it's nice to be able to hack it out with actions first. -
19. Re: how can I do optimistic locking with crud framework?
gavin.king Oct 19, 2006 8:30 PM (in response to cja987)/**
* An empty outcome list is interpreted to mean any
* outcome except for the null (redisplay) outcome.
*/
String[] ifOutcome() default {};
All actions are allowed to return void. And Seam treats void differently to null. Null means "problem with input, redisplay page". -
20. Re: how can I do optimistic locking with crud framework?
gavin.king Oct 19, 2006 8:35 PM (in response to cja987)Ah, I forgot to add the exception handling I meant to add :-)
I'll do that now.
Thanks for making me look into this stuff. Its good to have someone validate the design and code. -
21. Re: how can I do optimistic locking with crud framework?
cja987 Oct 19, 2006 8:43 PM (in response to cja987)I was going by the description of page actions in the seam docs, section 3.1.1
The page action method can return a JSF outcome. If the outcome is non-null, Seam will delegate to the defined JSF navigation rules and a different view may end up being rendered.
I took that to mean that a null outcome meant that it would proceed to the "default" view (the one it would land on without a page action).
At any rate, using the propagation parameter looks like a much cleaner way of doing it than blank page actions (though it's usually not a bad place to stick application-level audit log messages). Thanks for pointing it out (and for putting up with my endless questions). You rock my small self-centered universe :) -
22. Re: how can I do optimistic locking with crud framework?
cwash Nov 17, 2006 5:21 PM (in response to cja987)"gavin.king@jboss.com" wrote:
I have just tested this and it all works.
All I did was:
(1) Added a version attribute
(2) set scope="conversation" on contactHome (actually I will make this the default scope for a Home)
(3) put propagation="begin" on the Edit link.
I'm going to try this out soon. Seems like a good candidate for a wiki "tip" and perhaps reference guide nugget.