]
Gail Badner reassigned HHH-4760:
--------------------------------
Assignee: Adam Warski
NotAuditedException occurs when auditReader.getRevisions() is called
for javassist proxies
------------------------------------------------------------------------------------------
Key: HHH-4760
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4760
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.5.0-Beta-2
Reporter: Erik-Berndt Scheper
Assignee: Adam Warski
NotAuditedException occurs when auditReader.getRevisions() is called for javassist
proxies
In my code I see the following stacktrace if I try to retrieve the revision of a
javassist proxy:
org.hibernate.envers.exception.NotAuditedException:
nl.ibgroep.bap.model.domain.persoon.Ouder_$$_javassist_1 is not versioned!
at org.hibernate.envers.reader.AuditReaderImpl.getRevisions(AuditReaderImpl.java:126)
at
nl.ibgroep.bap.dao.impl.AuditRevisionJpaDaoImpl.getRevisionsFor(AuditRevisionJpaDaoImpl.java:58)
Ouder_$$_javassist_1.class is a Hibernate generated javassist proxy for Ouder.class,
which is versioned.
Code:
AuditReader vr = AuditReaderFactory.get(this.entityManager);
Class clazz = persistentObject.getClass();
List<Number> revisionNumbers = vr.getRevisions(clazz, persistentObject.getId());
I am able to work around this issue with the following code:
AuditReader vr = AuditReaderFactory.get(this.entityManager);
Class clazz = persistentObject.getClass();
if (persistentObject instanceof javassist.util.proxy.ProxyObject) {
if (LOGGER.isDebugEnabled()) {
StringBuilder output = new StringBuilder("Found javassist ProxyObject for
revision: class= ");
output.append(clazz.getSimpleName());
output.append("; superclass=
").append(clazz.getSuperclass().getSimpleName());
output.append("; interfaces=
").append(Arrays.asList(clazz.getInterfaces()).toString());
LOGGER.debug(output.toString());
}
clazz = clazz.getSuperclass();
}
List<Number> revisionNumbers = vr.getRevisions(clazz, persistentObject.getId());
However, a fix in envers would be greatly appreciated.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: