Bug 1247343

Summary: HHH-8456 Hibernate Envers throws RuntimeException in ValidityAuditStrategy when no audit records (table partitioning)
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Alexandre Cavalcanti <acavalca>
Component: HibernateAssignee: Gail Badner <gbadner>
Status: CLOSED WONTFIX QA Contact: Martin Simka <msimka>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3.2CC: cruwer, fspolti, gbadner, msimka, smarlow
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-13 09:46:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Log of the exception none

Description Alexandre Cavalcanti 2015-07-27 19:29:23 UTC
Created attachment 1056732 [details]
Log of the exception

1. Proposed title of this feature request

Not throwing that RuntimeException based on a configuration in persistence.xml

2. Who is the customer behind the request?
     Account: PROCERGS - Companhia de Processamento de Dados do Rio Grande do Sul (acct #633668)
     TAM customer: yes (Platform only)
     SRM customer: yes
     Strategic: yes
3. What is the nature and description of the request?

Customer is having the problem below:

*********
In Hibernate Envers (persistence.xml), I enabled the strategy for table partitioning, according to the development guide: 
http://docs.jboss.org/hibernate/orm/4.2/devguide/en-US/html/ch15.html#envers-partitioning

The class: ValidityAuditStrategy, throws RuntimeException when there is no audit record. This exception occurs when the Envers try to update an audit record with a date of final revision (revend_tstmp), but this audit record does not exist.

The database of my application receives data load from external applications and is not possible change these external applications to include their audit records.

In method ValidityAuditStrategy#updateLastRevision:

if (l.size() == 1) {
  //... doStuff - OK
} else {
  throw new RuntimeException("Cannot find previous revision for entity " + auditedEntityName + " and id " + id);
}
*********

In order to solve this problem he asked for a way to not throwing that RuntimeException based on a configuration in persistence.xml (for example)

Customer stated a similiar issue with no solution in: https://developer.jboss.org/thread/160195?tstart=0

4. Why does the customer need this? (List the business requirements here)

Red Hat doesn't have a suitable workaround for this issue

5. How would the customer like to achieve this? (List the functional requirements here)

He asked for a way to not throwing that RuntimeException based on a configuration in persistence.xml (for example)

6. For each functional requirement listed, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented.

Customer can run in their environment to test
Red Hat can replicate customer envirnment

7. Is there already an existing RFE upstream or in Red Hat Bugzilla?

No

8. Does the customer have any specific time-line dependencies and which release would they like to target (i.e. RHEL5, RHEL6)?

No

9. Is the sales team involved in this request and do they have any additional input?

No

10. List any affected packages or components.

Hibernate Envers 4.2.12.Final

11. Would the customer be able to assist in testing this functionality if implemented?

Yes

Comment 2 Gail Badner 2015-07-31 03:07:05 UTC
https://hibernate.atlassian.net/browse/HHH-8456