[hibernate-issues] [Hibernate-JIRA] Assigned: (HHH-4760) NotAuditedException occurs when auditReader.getRevisions() is called for javassist proxies

Gail Badner (JIRA) noreply at atlassian.com
Wed Apr 28 14:14:29 EDT 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

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: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list