5 Replies Latest reply on Jul 21, 2010 1:13 AM by Richa Khurana

    Fetching revision number before record insertion

    Richa Khurana Newbie



      I have the following requirement-


      I have an employee class, which is mapped to table EMPLOYEE, Also this is marked as audited and hence the corresponding audit records goto EMPLOYE_AUD table.

      In certain scenarios where employee satisfies a few conditions, we need to tag the employee and store the following information-


      Table name : TAG_EMPLOYEE which has following fields coming from tables-

      Employee Id from EMPLOYEE

      Employee name from EMPLOYEE



      Now, we want to have all these 3 DB operations of inserting/updating an employee record, inserting records in employee_aud and tagging of employee in a single transaction. Also, rev is available to us (in AuditSync's API  beforeCompletion -> executeInSession -> getCurrentRevisionData) when we have persist flag true, i.e. we are about to flush the data.


      My query is, can i somehow fetch the revision number which envers is about to create for employee_aud table, before the actual record insertion without losing any of the sequence values in the corresponding rev sequence. Also, would the corresponding solution work in a clustered JVM environment(assuming DB is the same).