Our system under test uses Hibernate for persistence. We do automated system tests and want to put the database in the same condition before each test is run. Currently we use some Oracle triggers and procedures to reset Insert statements. But it cannot handle Updates and Deletes.
Is there already a solution for this inside Hibernate for this? We need to do that with an Oracle database, so in-memory databases are no solution for us. We wouldn't even have the DDL scripts for them since we do that manually and only for Oracle.
Or if there is not already a solution inside Hibernate, my idea was to hook into Hibernate somehow (?) in order to record all modifications on the database data (inserts, updates and deletes) and then to restore the database prior to these changes.
The requirements are this: remember an initial state of our data in the database, watch the changes and if requested, reset the data to the prior state. This should be completely automatical and with good performance. And it need to be used even for manual data changes from within the GUI, not just in the context auf automated testing.
Any ideas how to solve this?
|