Is there support for long transactions? [message #718508] |
Wed, 24 August 2011 10:44  |
Eclipse User |
|
|
|
If I don't get wrong, there is no support for transactions longer than a single call to a service. I'm actually defining a wizard which reuses detail forms, and every form has it's FormData. The easiest solution I see is to define a global FormData for the wizard and copy value from single FormDatas while wizard flows.
Is there some other pattern better suited for Scout?
Thanks
|
|
|
|
|
|
Re: Is there support for long transactions? [message #719146 is a reply to message #718775] |
Fri, 26 August 2011 03:51   |
Eclipse User |
|
|
|
What about this approach:
- every FormData involved in a long transaction (LT) has a boolean flag LongTransaction
- when the form runs inside a LT, it's flag is put to true by a MasterProcessService and the form is used as usually
- the form's ProcessService reads the flag, if true then no CRUD take place and the FormData is saved into server session (together with infos about the operation to execute), else the normal CRUD is executed
- going on, the sequence of FormDatas is collected (sorted by insertion) in server session
- in the end, the MasterProcessService commits: the sequence of FormDatas is passed to corresponding ProcessService's operation with LongTransaction put to false (so every ProcessService execute the real CRUD)
The advantage of this approach are: I can reuse the existing FormDatas and its services, with a little overhead (manage the flag), I can manage complex workflows (i.e. first create something, then update something else, then delete, etc.), and I do DRY .
The disadvantage are: server session full of heavy data, some additional coding when a form needs data from previous steps (which would be written only at the end of LT).
My doubts are:
- Can I access the server session inside a ServiceProcess?
- ServiceProcesses are transaction aware? (i.e. if I call a SP inside another SP, is the transaction propagated?)
Hope I was clear...
I'll try this in the weekend, every suggestion would be really appreciated 
Bye
|
|
|
Re: Is there support for long transactions? [message #719266 is a reply to message #719146] |
Fri, 26 August 2011 10:40  |
Eclipse User |
|
|
|
Quote:- Can I access the server session inside a ServiceProcess?
-> Yes, ServerSession.get()
Quote:- ServiceProcesses are transaction aware? (i.e. if I call a SP inside another SP, is the transaction propagated?)
-> Yes, the transaction is committed when the remote service call returns to the client. (see ServiceTunnelServlet.RemteServiceJob. The commit is executed when the ServerJob#runTransactionWrapper() is finished ).
|
|
|
Powered by
FUDForum. Page generated in 0.06450 seconds