[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5955) Add support to @OrderColumn JPA2 annotation to work with @AuditMappedBy

benoit heinrich (JIRA) noreply at atlassian.com
Wed Feb 23 05:12:08 EST 2011


Add support to @OrderColumn JPA2 annotation to work with @AuditMappedBy
-----------------------------------------------------------------------

                 Key: HHH-5955
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5955
             Project: Hibernate Core
          Issue Type: Bug
          Components: envers
    Affects Versions: 3.6.1, 3.6.0
         Environment: jboss 6.0.0.Final and hibernate 3.6.0.Final
            Reporter: benoit heinrich


Hi guys,
 
I'm working on a project where we're using envers and since we're migrating from jboss 4.2.3 to jboss 6.0.0.Final (finally), I'm then upgrading the old envers to the new one.
Part of the migration I've changed all the @IndexColumn by the new JPA2 @OrderColumn and it seems that envers doesn't work with that new annotation (or I might do something wrong here )
 
Also, since we're now using the @OrderColumn the "position" column on the referenced entity has been removed as the hibernate documentation (and JPA2 specs) ask for it.  Since it's been removed I'm getting the problem.
 
Here is the example mapping:
{code}
@Entity
@Audited
public class OrganizationEntity {
 
          @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
          @JoinColumn(name = "org_entity_id", columnDefinition = "int", nullable = false)
          @OrderColumn(name = "position", columnDefinition = "tinyint", nullable = false)
          @AuditMappedBy(mappedBy = "organizationEntity", positionMappedBy = "position")
  private List contactDetailList;
}
 
@Entity
@Audited
public class OrganizationEntityContactDetail {
  @ManyToOne(fetch = FetchType.EAGER)
          @JoinColumn(name = "org_entity_id", columnDefinition = "int", nullable = false, insertable = false, updatable = false)
          private OrganizationEntity organizationEntity;
}
{code}
 
Every time I deploy this I'm getting the following error:
{code}
Caused by: org.hibernate.HibernateException: could not init listeners
          at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:205) :3.6.0.Final
          at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1980) :3.6.0.Final
          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842) :3.6.0.Final
          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902) :3.6.0.Final
          ... 73 more
Caused by: org.hibernate.MappingException: @AuditMappedBy points to a property that doesn't exist: com.example.services.organization.entity.OrganizationEntityAddress.position
          at org.hibernate.envers.configuration.ClassesAuditingData.forcePropertyInsertable(ClassesAuditingData.java:83)
          at org.hibernate.envers.configuration.ClassesAuditingData.updateCalculatedFields(ClassesAuditingData.java:72)
          at org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:86)
          at org.hibernate.envers.configuration.AuditConfiguration.(AuditConfiguration.java:97)
          at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:129)
          at org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:335)
          at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198) :3.6.0.Final
          at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181) :3.6.0.Final
          at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194) :3.6.0.Final
          ... 76 more
{code}

More details can be read there: http://community.jboss.org/message/589031

Thanks for looking at it :)

Cheers,
/Benoit

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