Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transaction scope in Java triggers

Status
Not open for further replies.

jonatan

Programmer
Mar 24, 2003
14
BR
I use Progress Java triggers. When I update table A, the trigger fires an update in table B. This fires the trigger for table B, that looks for the original record in table A. The problem is: in this point, the trigger returns an error, cause the record I want to find is already locked. But the record is locked by myself! In my mind, the transaction should be the same, and the record should not be locked. Does anyone know some documentation that describes the transaction scope in java triggers in Progress? I'm using Progress 9.1C.

Thanks,

Jonatan Schroeder
 
jonatan,

u are updating the record in table a so it has to be locked. it sounds like the problem is that you are still in the loop of doing work on table a when you start your update & search for /from table b. why are you looking for an instance of a record you already have found (again)? if you want to post the code i'll take a look and see if i can work it out.

regards,

longhair
 
The situation is something like this:

Code:
create table a (
  id number,
  ...
);

create table b (
  id number,
  a_id number,
  ...
);

The trigger for table B verifies if table A exists. In some situations, trigger for table A inserts a record in table B. In this case, when the trigger for table B tries to verify the existence of the record in table A, it fails.

Thanks,

Jonatan Schroeder
 
jonatan,

if both of these are in the same loop i don't know if you can do it. i'm not sure you could even alias table a since you are actively creating / adding to it. i still don't understand why you are trying to find the record in table a, from table b, that led you to table b. what you may want to try is to end your loop before you create table b. then create table b in another loop. are you looking to pull something from table a to insert into table b (like a_id num)?

regards,
longhair

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top