- 
        1. Re: An audited relation to a non-audited entityhernanbolido Nov 27, 2009 12:29 PM (in response to obeah)Hello! 
 I think that the property targetAuditMode of @Audited could help you to solve this.
 You can use:
 @Audited(targetAuditMode=RelationTargetAuditMode.NOT_AUDITED)
 In this case, the javadoc says:
 @return Specifies if the entity that is the target of the relation should be audited or not. If not, then when reading a historic version an audited entity, the realtion will always point to the "current" entity.
 This is useful for dictionary-like entities, which don't change and don't need to be audited.
 See the javadoc for the Audited annotation.
 Hernan.
- 
        2. Re: An audited relation to a non-audited entityobeah Nov 27, 2009 5:04 PM (in response to obeah)Hello Hernan, 
 Thank you, it seems to be exactly what I need. I currently use the latest GA version 1.2.1 with Hibernate 3.3. This feature was added obviously after this release and is available in trunk as a part of hibernate core (3.5). Do you know if it is possible to build stand-alone envers that includes these extensions and is compatible with hibernate 3.3?
- 
        3. Re: An audited relation to a non-audited entityhernanbolido Nov 27, 2009 6:32 PM (in response to obeah)Hi! 
 Sure, there is a branch named envers-hibernate-3.3 compatible with hibernate 3.3
 It contains all bug fixes and new features that were added to trunk first.
 @Adam, are you planning a hibernate-3.3 compatible release for envers?
 Thanks. Hernan.
- 
        4. Re: An audited relation to a non-audited entityobeah Nov 27, 2009 8:05 PM (in response to obeah)Thank you again, Hernan. 
 It seems there is a bug in the class ToOneRelationMetadataGenerator
 Old logic remained in the code. It placed after new coding and exception is thrown anyway:if (configuration == null) { configuration = mainGenerator.getNotAuditedEntitiesConfigurations().get(referencedEntityName); if (configuration != null) { RelationTargetAuditMode relationTargetAuditMode = propertyAuditingData.getRelationTargetAuditMode(); if (!RelationTargetAuditMode.NOT_AUDITED.equals(relationTargetAuditMode)) { throw new MappingException("An audited relation from " + entityName + "." + propertyAuditingData.getName() + " to a not audited entity " + referencedEntityName + "!" + ". Such mapping is possible, but has to be strictly defined using RelationTargetAuditMode.NOT_AUDITED in @Audited."); } } } if (configuration == null){ throw new MappingException("An audited relation from " + entityName + "." + propertyAuditingData.getName() + " to a not audited entity " + referencedEntityName + "!"); }
- 
        5. Re: An audited relation to a non-audited entityobeah Nov 27, 2009 8:20 PM (in response to obeah)Sorry, my mistake, still had old jar linked in one place 
- 
        6. Re: An audited relation to a non-audited entityadamw Nov 28, 2009 3:09 AM (in response to obeah)Hello, 
 yes, I'm certainly planning on releasing new versions of Hibernate 3.3 compatible Envers, in some near future.
 Meanwhile, you can use the snapshot, I deploy it quite regularly (last time, yesterday):
 http://snapshots.jboss.org/maven2/org/jboss/envers/jboss-envers/1.2.2-hibernate-3.3-SNAPSHOT/
 As hernanbolido wrote, specifying the targetEntityMode is the way to solve your problem, there is however one bug still unresolved, concerning many-to-many relations:
 http://opensource.atlassian.com/projects/hibernate/browse/HHH-4090
 Adam
 
     
    