5 Replies Latest reply on Jun 27, 2009 6:56 AM by adamw

    Envers and mappings

      I have a number of classes that have attributes which are interfaces rather than a concrete class and I'm getting " org.hibernate.MappingException: Type not supported for auditing: org.hibernate.type.AnyType" on each of these. Is there a workaround for this?

      Thanks.

        • 1. Re: Envers and mappings
          adamw

          Hello,

          how are these interfaces annotated?

          Adam

          • 2. Re: Envers and mappings

            I'm migrating to annotations so it's currently in XML

            The audited class:

             <class name="com.test.Invoice" table="Invoice" >
            
             ...
            
             <any name="customer" meta-type="string" id-type="long" lazy="false">
             <meta-value value="STUDENT" class="com.test.Student" />
             <meta-value value="SCHOOL" class="com.test.School" />
             <column name="CUSTOMER_CLASS"/>
             <column name="CUSTOMER_ID"/>
             </any>
             </class>
            


            Each class just has the @Audited annotation, there's no XML definition for the Customer interface.



            • 3. Re: Envers and mappings
              adamw

              Well, you are using the any-type, which isn't supported. This doesn't really has much to do with interfaces. Try using one-to-many or many-to-many.

              Adam

              • 4. Re: Envers and mappings

                Thanks for the guidance, I've just been moved onto this project so I'm not wholly familiar with hibernate but how could I rewrite the any clause with many-to-one clauses that reflect the same interface structure? Student and School both implement the Customer interface but need to inherit from another Class as well, so I can't rewrite a common ancestor class.

                • 5. Re: Envers and mappings
                  adamw

                  Hello,

                  well, you know, I can't tell you how you should map it without knowing the project ;). But it sounds as you need to use some inheritance schema. Or you could always add support for any-type mappings to Envers :)

                  Adam