Set rollback explicitly without exception

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Set rollback explicitly without exception

wreeder
Hi,

I am developing a service using XPL that delegates change requests to other XPL services, all invoked directly as XPL processors. Given this flow, all database changes are wrapped in a single transaction.

I run into a problem when the first delegated service succeeds in saving its change, and one of the later services fails due to validation logic in the XPL. I would like to rollback the transaction for the entire request when a validation error occurs without creating an exception so I can return the corresponding validation error code to the service consumer. However, I see the DatabaseContext only executes a rollback when the PiplineContext ends with an exception.

I am looking for a way to explicitly tell the DatabaseContext ContextListener to rollback the transaction explicitly. Perhaps a Processor to set a PipelineContext attribute that would signal the DatabaseContext ContextListener to rollback the transaction.

Thanks,
Bill
Reply | Threaded
Open this post in threaded view
|

Re: Set rollback explicitly without exception

Alessandro Vernet
Administrator
Bill,

On Mon, Aug 4, 2008 at 2:47 PM, Bill Reeder <[hidden email]> wrote:
> I am looking for a way to explicitly tell the DatabaseContext
> ContextListener to rollback the transaction explicitly. Perhaps a Processor
> to set a PipelineContext attribute that would signal the DatabaseContext
> ContextListener to rollback the transaction.

Unfortunately this "standard behavior" is hard-coded. Would it be
possible with your database to issue a ROLLBACK "manually" with the
SQL Processor when you detect the condition where you would like to
have a rollback. (E.g., I think this is possible with Oracle.)

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Set rollback explicitly without exception

wreeder
Alex,

Alessandro Vernet wrote
Would it be possible with your database to issue a ROLLBACK "manually" with the
SQL Processor when you detect the condition where you would like to
have a rollback. (E.g., I think this is possible with Oracle.)
I did not have any luck with that approach, so I decided to create my own Processor to call commit or rollback on the connection maintained by the DatabaseContext class.

Thanks for your help on this,
Bill