cancel
Showing results for 
Search instead for 
Did you mean: 

Transaction Management MDM Java API

former_member192347
Participant
0 Kudos

I guess if you are updating data in MDM repository using MDM Java API, it's necessary to have Transaction Management MDM Java API.

Here is the scenario, Let's I want to add a Master record to MDM repository (Vendor). This record is having Lookup table field (Account Group) value that does not exist in Lookup table Account Groups.

So I would like to first add record into the Account Groups Lookup table and then add the Master record to Vendors table. I would like both updates to be successful then only commit or rollback the update to repository.

Alternately, I can check the return code/status of 1st update then accordingly do the 2nd update or issue delete 1st record update (to simulate rollback).

However this mimicking transaction rollback won't guarantee 100% rollback, because deleting 1st record update might fail.

I think it's necessary to define this unit of work as a Transaction and control it.

If there is another way to add a record to Main table and Lookup/Qualified/Hierarchy table simultaneously then there is no need of Transaction.

Abhay

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Abhay,

<b>If there is another way to add a record to Main table and Lookup/Qualified/Hierarchy table simultaneously then there is no need of Transaction.</b>

There are no direct methods currently(as of MDM 5.5SP3) available in MDM API.

You have to build your own logic to implement.

Regarding the Transaction management, I guess you are talking aboout two phase commit scenarios. I would say you can achieve this using EJB's in which u write the business logic (In this case the MDM API code).

For Example:

Adding a record to Main table,

Let say 2 fields

1. Free text field.

Its straight forward method, use A2iFiled object and assign some value to it.

2. Lookup field.

For this.

First get the Record id for the value, which you are trying to add, from the lookup table.

If the lookup table does not find the value in the table, it return zero or some negative value(which I am not sure).

Based on the return value you can add the value into the lookup table and then into the main table.

Just putting a sample scenario. Hope this helps.

Thanks and regards

Subbu

former_member192347
Participant
0 Kudos

FYI

If you know the Two Phase commit concept then you would understand that I am NOT talking about the Two Phase Commit. Two phase commit spans across multiple databases/ systems.

About using the EJB, let's say I have a transaction aware Session Bean and two Entity Beans (one for Main table and one for Lookup table). And try to update the Lookup table first and then try to update the Main table. If the 2nd table update (Main table) fails, it's not possible to rollback the transaction, because underlying API (MDM API) do not support it. EJB internally uses RDBMS mechanism to control the Transaction.

Your example seems to echo what I had put in my post.

If you validate that there is NO way to add record to Main table and Lookup/Qualified/Hierarchy table simultaneously then definitely there is a need of Transaction.

Abhay

Former Member
0 Kudos

Hi Abhay,

<b>If you validate that there is NO way to add record to Main table and Lookup/Qualified/Hierarchy table simultaneously then definitely there is a need of Transaction.</b>

For sure, there is no method in MDM API, which does this kind of task.

<b>About using the EJB, let's say I have a transaction aware Session Bean and two Entity Beans (one for Main table and one for Lookup table). And try to update the Lookup table first and then try to update the Main table. If the 2nd table update (Main table) fails, it's not possible to rollback the transaction, because underlying API (MDM API) do not support it. EJB internally uses RDBMS mechanism to control the Transaction.</b>

Any how you have the record id when you update/add the record into lookup table. Use that record id and delete the record using the MDM API method, when the main record update /add fails.

May be you can make use of the listener methods available in MDM API.

Thanks and Regards

Subbu