0 Replies Latest reply on Sep 1, 2010 10:29 AM by Robin G

    Envers doesn't support HBM 'properties' element?

    Robin G Newbie

      Envers doesn't seem to support grouping relations inside of an <properties> element. In my case, I'm trying to use the unique attribute of the properties tag as described here. Is there an alternative way to achieve the same behavior that is supported?

       

      Works:

       

      <joined-subclass name="Tcr2IeAssociation" table="TCR_IE">
        <key column="ID_BB" />
      
        <many-to-one name="technicalComponentRelease" column="ID_TCR" not-null="true"/>
        <many-to-one name="infrastructureElement" column="ID_IE" not-null="true"/>
      
      </joined-subclass>
      
      

       

      Does not work:

       

      <joined-subclass name="Tcr2IeAssociation" table="TCR_IE">
        <key column="ID_BB" />
        <properties name="uniqueEnds" unique="true">
          <many-to-one name="technicalComponentRelease" column="ID_TCR" not-null="true"/>
          <many-to-one name="infrastructureElement" column="ID_IE" not-null="true"/>
        </properties>      
      </joined-subclass>
      
      
      

       

      Removing the unique attribute has no effect.
      The same error is thrown whenever the properties tag is in use:

       

      Unable to read the mapped by attribute for infrastructureElementAssociations in MY.model.Tcr2IeAssociation!
      
           [java]     at org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.getMappedBy(CollectionMetadataGenerator.java:561)
           [java]     at org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addOneToManyAttached(CollectionMetadataGenerator.java:161)
           [java]     at org.hibernate.envers.configuration.metadata.CollectionMetadataGenerator.addCollection(CollectionMetadataGenerator.java:144)
           [java]     at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addValue(AuditMetadataGenerator.java:167)
           [java]     at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.addProperties(AuditMetadataGenerator.java:187)
           [java]     at org.hibernate.envers.configuration.metadata.AuditMetadataGenerator.generateSecondPass(AuditMetadataGenerator.java:447)
           [java]     at org.hibernate.envers.configuration.EntitiesConfigurator.configure(EntitiesConfigurator.java:113)
           [java]     at org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:86)
           [java]     at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:99)
           [java]     at org.hibernate.envers.event.AuditEventListener.initialize(AuditEventListener.java:335)
           [java]     at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
           [java]     at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
           [java]     at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)