java - How to compare two savepoints programmatically? -


i want compare 2 savepoints , check if there commits database in between. example, consider following code snippet

 savepoint save1 = connection.setsavepoint("before);  // processing happens here, can commit changes db.  process();  savepoint save2 = connection.setsavepoint("after");   // compare 2 savepoints see if there commits in process() method 

now trying explore is: there way can programmatically check if there commits between 2 savepoints?

the simplest way having stack object push current operation dboperationstack.push(new string[]("operation_type", "operation_name", current_timestamp)). [this plain pseudo-code, change data-structure, scope, concurrency etc.]

you can add above line wherever required database operation.

when reach savepoint_2, peek stack & check if it's savepoint_1, if it's not, there might operations in between them update, insert etc. recent one.

commit,    process_xyz, 2016-01-29 15:03:08.713 savepoint, savepoint_1, 2016-01-29 15:02:08.713 

Comments