Experience Hibernate cascade save, save transactions with Oracle Trigger

1, the cascade of multi-table save, save multiple tables in a single save, cascade and services under the joint use of Spring's transaction, the transaction characteristics are:

      (1) Atomicity: All operations of the entire transaction, either completed or not completed all impossible stuck in the middle of a link. Transaction error occurs during execution, it will be rolled back (Rollback) to the state before the start of the transaction, as the transaction never performed the same.
      (2) Consistency: before the transaction begins and after the end of the transaction, integrity constraints of the database is not corrupted.
      (3) Isolation: isolation transaction execution, so that if they were the only operating system executing within a given time. If there are two transactions running at the same time, perform the same function, isolation transaction will ensure that each transaction in the system that only the transaction using the system. This property is sometimes referred to as serialization, in order to prevent confusion between the transaction operations, or be serialized serialized request, so that only one request at the same time for the same data.
      (4) Persistence: After the transaction is completed, the firm changes made to the database will be stored in the persistent database, and will not be rolled back.

2, trigger problems when establishing operations in multiple tables above transactions will be faced:
  A, such as a cascading save the table, Table II, when the trigger on a table build AFTER INSERT OR UPDATE trigger the necessary data from table I and table II: table II data will not insert or update trigger on a table already started reading the data in table II. Resulting in inaccurate data.

  b, the transaction has to Table II were deletion, insertion operation, the table also established two insert row-level triggers the deletion of Schedule III and row-level triggers. (Two to manually trigger the database table to do two deletions, insertions can normally trigger data to Table III): will appear when the program operation, only delete, without data insertion. Suspected transaction resulted in resource consumption, not as the result of database operations like that get the expected (here humbly ask for advice).

Guess you like

Origin www.cnblogs.com/hanzhiyong/p/11506101.html