[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3740) Unable to build EntityManagerFactory when using a non-audited ManyToOne in Audited components

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


Unable to build EntityManagerFactory when using a non-audited ManyToOne in Audited components 
----------------------------------------------------------------------------------------------

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


Since the resolution of HHH-3563, relations in components are now supported. 
However, if I try to use a @NotAudited @ManyToOne in an @Embeddable, then Envers does not start up.
Removing @NotAudited to the @ManyToOne  @Embeddable and adding @Audited to the related entity resolves the issue.

This does not occur with @NotAudited @ManyToOne in an @Entity.

See attached test case to reproduce this issue.



Stack trace:
javax.persistence.PersistenceException: Unable to build EntityManagerFactory
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
	at org.hibernate.envers.test.AbstractEntityTest.init(AbstractEntityTest.java:94)
	at org.hibernate.envers.test.AbstractEntityTest.init(AbstractEntityTest.java:82)
	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.invokeConfigurationMethod(Invoker.java:398)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:145)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:82)
	at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:167)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:104)
	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: org.hibernate.HibernateException: could not init listeners
	at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:205)
	at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1352)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
	at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
	at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
	... 24 more
Caused by: org.hibernate.MappingException: An audited relation to a non-audited entity org.hibernate.envers.test.entities.UnversionedStrTestEntity!
	at org.hibernate.envers.configuration.metadata.ToOneRelationMetadataGenerator.addToOne(ToOneRelationMetadataGenerator.java:59)
	at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addValue(AuditMetadataGenerator.java:126)
	at org.hibernate.envers.configuration.metadata.ComponentMetadataGenerator.addComponent(ComponentMetadataGenerator.java:40)
	at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addValue(AuditMetadataGenerator.java:121)
	at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addProperties(AuditMetadataGenerator.java:161)
	at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateSecondPass(AuditMetadataGenerator.java:348)
	at org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:96)
	at org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:87)
	at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:99)
	at org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:232)
	at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
	at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
	at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
	... 28 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