In this post, I show the
result of POC performed using database adapter to check on XA, NON-XA data
source and Get Active Unit Of Work property.
Two tables created in
same database
Case 1: When no Catch
All block added to BPEL flow
· Both
Data Sources NON-XA & "Get Active Unit of work" checked or unchecked:
First Insert will work if there is error in second
insert. So no effect of “Get Active Unit of Work” in Non-XA Data Source.
· Both
Data Sources XA & “Get Active Unit Of Work” is unchecked: First Insert will
rollback if there is error in second insert.
· Both
Data Sources XA & “Get Active Unit Of Work” is checked: First insert will
rollback if there is error in second insert.
Case 2: When there is
Catch All Block added to BPEL Flow
· Both
Data Sources NON-XA & "Get Active Unit of work" checked or unchecked:
First Insert will work if there is error in second
insert. So no effect of “Get Active Unit of Work” in Non-XA Data Sources.
· Both
Data Sources XA & “Get Active Unit Of Work” is unchecked: First Insert will
work if there is error in second insert.
· Both
Data Sources XA & “Get Active Unit Of Work” is checked: First insert will
rollback if there is error in second insert.
Two tables created in
two different databases
Case 1: When there is
Catch All Block added to BPEL Flow
· Both
Data Sources NON-XA & "Get Active Unit of work" checked or unchecked:
First Insert will work if there is error in second
insert. So no effect of “Get Active Unit of Work” in Non-XA Data Sources.
· Both
Data Sources XA & “Get Active Unit Of Work” is checked: First insert will
work if there is error in second insert.
· Both
Data Sources XA & “Get Active Unit Of Work” is unchecked: First insert will
work if there is error in second insert.
· Both
Data Sources XA & “Get Active Unit Of Work” is checked & below property
is set: First insert will rollback if there is error in second
insert.
· Both
Data Sources XA & “Get Active Unit Of Work” is unchecked & below
property is set: First insert will rollback if there is error
in second insert.
· Both
Data Sources NON-XA & “Get Active Unit Of Work” is checked & below
property is set: First insert will insert if there is error in
second insert.
Property:
<property name="bpel.config.transaction" many="false"
type="xs:string">required</property>
Hi
ReplyDeleteWhat is the below property you mention in the last 3 cases ?
Thanks
"Get Unit Of Work" the property that you need to choose when you configure Data Base adapter.
DeleteThanks
Vivek Garg
What configuration we need to do in weblogic console for non-xa driver to support xa driver features. For an example two different tables connected to same data base and if any one fails it should get rollback the transaction for non xa driver.
ReplyDelete@Vivek, so what is the final conclusion of this blog post?
ReplyDeleteThis post helps to understand when we need to use XA & NON-XA data sources and when to use Get Unit Of Work property.
DeleteThis Post was amazing, thanks for sharing this. I have doubts, Please clarify me.
ReplyDeleteThe first portion "Two tables created in same database" was pretty clear for me, but in the second portion "Two tables created in two different databases", you have specified
Doubt 1)
"Both Data Sources XA & “Get Active Unit Of Work” is checked: First insert will work if there is error in second insert." I was expecting the first insersion to be rollback....
Doubt 2)
Both Data Sources XA & “Get Active Unit Of Work” is checked & below property is set: First insert will rollback if there is error in second insert.
I couldn't undestand the "below property is set" which property?
Hi Syam,
DeleteI missed to mention that property in the post. I have updated my post with that property. Thanks for letting me know.
Property: required
Vivek
Hi Vivek,
ReplyDeleteThe post was good highlighting the importance of Getactiveunit of work.But it would be really helpful to all of us if u mention how this property plays a role in rollback or insert
Regards,
Kumar
Hi Kumar,
DeleteGetActive Unit of work helps to maintain the same transaction in case of XA data source when we are dealing with same database.
Vivek
The below are gist of this excellent article
ReplyDelete1) "Get Active Unit of work helps to maintain the same transaction in case of XA data source when we are dealing with same database." - already mentioned above by Vivek
2) Multiple inserts belonging to XA datasources in different databases , will participate in different transactions unless transaction=required property is set.
Hi Vivek
ReplyDeleteI have a requirement where I want both inserts to happen in one transaction i.e. if second one fails first insert should rollback.and the fault in second insert should also be caught in catch block .
Both tables are in single database with XA data source.
when getActiveUnitOfWork is checked and catch block is used, first insert gets rolled back but audit trail of the instance is not available and the error is only recorded in logs.