Motasem
Motasem

Reputation: 619

MySQL Trigger with transaction insert or update

i'm using mysql db & java, so in my application i need to use trigger, but i need to make it save while inserting or updating. when insering new record in table A, trigger will do the work to insert some information in another table B. also when doing update for records in table A, trigger will update records for table B.

if transaction during update or insrt rolledback, does this rolled back any changes done by the trigger.??!!

Upvotes: 3

Views: 654

Answers (1)

Eric Petroelje
Eric Petroelje

Reputation: 60518

Yes, if the transaction is rolled back, the work done by the trigger will also be rolled back (unless you do some monkeying with transaction scoping inside the trigger to specifically prevent this)

Upvotes: 1

Related Questions