[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4090?page=c...
]
Chester do Nascimento commented on HHH-4090:
--------------------------------------------
Also reproducible here with MySQL, Hibernate 3.3.1 GA and Hibernate-Envers 3.5.0.Beta-1.
For Many-To-Many the current syntax may not be enough. For example, I may either want not
to audit the relationship at all, but I could also want to audit the join table but not
the other side.
Real-life example: if I am linking this entity to several entries in a big, non-mutable
dictionary (as in the example on HHH-410) - it may be desired to track the releationships,
but not the (non-existent) changes at the other side.
RelationTargetAuditMode.NOT_AUDITED not working with many-to-many
relations
---------------------------------------------------------------------------
Key: HHH-4090
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-4090
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.3.1
Environment: Hibernate 3.3.1-GA, PostgreSQL 8.2
Reporter: Jacek Kunicki
Assignee: Adam Warski
When defining a @ManyToMany relation from an @Audited entity to a non-@Audited one using
RelationTargetAuditMode.NOT_AUDITED:
@Entity
@Audited
class A {
@ManyToMany
@JoinTable(...)
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
private B b;
// getters, setters ...
}
@Entity
class B {
...
}
the following error occurs during deployment:
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:1338)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
at
org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at
org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
... 145 more
Caused by: org.hibernate.MappingException: An audited relation from A to a non-audited
entity: B
at
org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.throwRelationNotAudited(CollectionMetadataGenerator.java:537)
at
org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addValueToMiddleTable(CollectionMetadataGenerator.java:390)
at
org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addWithMiddleTable(CollectionMetadataGenerator.java:310)
at
org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addCollection(CollectionMetadataGenerator.java:154)
at
org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addValue(AuditMetadataGenerator.java:144)
at
org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addProperties(AuditMetadataGenerator.java:164)
at
org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateSecondPass(AuditMetadataGenerator.java:419)
at
org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:100)
at
org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:86)
at
org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:99)
at
org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:260)
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)
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira