[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3736) Envers EntityInstantiator does not support private constructors for immutable entities

Erik-Berndt Scheper (JIRA) noreply at atlassian.com
Thu Jan 29 04:23:38 EST 2009


Envers EntityInstantiator does not support private constructors for immutable entities
--------------------------------------------------------------------------------------

                 Key: HHH-3736
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3736
             Project: Hibernate Core
          Issue Type: Bug
          Components: envers
    Affects Versions: 3.4
            Reporter: Erik-Berndt Scheper


Hibernate supports the use of private constructors in JPA, which is typically used for immutable entities.
Auditing of these entities works perfectly fine. However, retrieving audit records using getAuditReader().find leads to an IllegalAccessException in org.hibernate.envers.entities.EntityInstantiator

See attached test case to reproduce this.

Stack trace:
org.hibernate.envers.exception.AuditException: java.lang.IllegalAccessException: Class org.hibernate.envers.entities.EntityInstantiator can not access a member of class org.hibernate.envers.ebstest.entities.Country with modifiers "private"
	at org.hibernate.envers.entities.EntityInstantiator.createInstanceFromVersionsEntity(EntityInstantiator.java:85)
	at org.hibernate.envers.entities.EntityInstantiator.addInstancesFromVersionsEntities(EntityInstantiator.java:102)
	at org.hibernate.envers.query.impl.EntitiesAtRevisionQuery.list(EntitiesAtRevisionQuery.java:90)
	at org.hibernate.envers.query.impl.AbstractAuditQuery.getSingleResult(AbstractAuditQuery.java:104)
	at org.hibernate.envers.reader.AuditReaderImpl.find(AuditReaderImpl.java:103)
	at org.hibernate.envers.ebstest.integration.accesstype.ImmutableFieldAccessType.testHistoryOfId1(ImmutableFieldAccessType.java:50)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:580)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:478)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:617)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:885)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:110)
	at org.testng.TestRunner.runWorkers(TestRunner.java:712)
	at org.testng.TestRunner.privateRun(TestRunner.java:582)
	at org.testng.TestRunner.run(TestRunner.java:477)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:324)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:319)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
	at org.testng.SuiteRunner.run(SuiteRunner.java:198)
	at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:823)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:790)
	at org.testng.TestNG.run(TestNG.java:708)
	at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:73)
	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:124)
Caused by: java.lang.IllegalAccessException: Class org.hibernate.envers.entities.EntityInstantiator can not access a member of class org.hibernate.envers.ebstest.entities.Country with modifiers "private"
	at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
	at java.lang.Class.newInstance0(Class.java:344)
	at java.lang.Class.newInstance(Class.java:303)
	at org.hibernate.envers.entities.EntityInstantiator.createInstanceFromVersionsEntity(EntityInstantiator.java:83)
	... 27 more


-- 
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