-
1. Re: Envers and mappings
adamw Jun 26, 2009 10:37 AM (in response to iamdave)Hello,
how are these interfaces annotated?
Adam -
2. Re: Envers and mappings
iamdave Jun 26, 2009 10:51 AM (in response to iamdave)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 Jun 26, 2009 11:13 AM (in response to iamdave)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
iamdave Jun 26, 2009 11:47 AM (in response to iamdave)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 Jun 27, 2009 6:56 AM (in response to iamdave)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