[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3729) @AuditJoinTable annotation has no effect for embedded concrete subclasses of a MappedSuperClass

Erik-Berndt Scheper (JIRA) noreply at atlassian.com
Wed Feb 4 05:56:40 EST 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3729?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32304#action_32304 ] 

Erik-Berndt Scheper commented on HHH-3729:
------------------------------------------

I have been pondering a bit more about this (a good night's sleep always helps). I believe we need an even more general way to override auditing behavior for components. I have created an implementation and a couple of integration tests (based on the file I attached in my previous comment). 

The general idea is as follows:
*Provide new annotations, @AuditingOverride and @AuditingOverrides
*@AuditingOverrides provides the possibility to add one or more @AuditingOverride annotations (just like AssociationOverrides and AttributeOverrides)
*@AuditingOverride provides the possibility to enable / disable auditing for a property inside a component, or to change the audit-table for a property of a component. More configuration can be added later, but this seems sufficient right now.

This leads to the following sample for a test entity using a component:

@Embedded
@AssociationOverride(name = "range", joinColumns = { @JoinColumn(name = "VJTRCTE1_ID", insertable = true, updatable = false, nullable = false) })
@org.hibernate.envers.Audited
@org.hibernate.envers.AuditingOverride(name = "range", auditJoinTable = @org.hibernate.envers.AuditJoinTable(name = "JOIN_TABLE_COMPONENT_1_AUD", inverseJoinColumns = @JoinColumn(name = "VJTRTE_ID")))

private XxxComponent component1;


> @AuditJoinTable annotation has no effect for embedded concrete subclasses of a MappedSuperClass
> -----------------------------------------------------------------------------------------------
>
>                 Key: HHH-3729
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3729
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: envers
>    Affects Versions: 3.5
>            Reporter: Erik-Berndt Scheper
>         Attachments: envers-HHH-3729-testcase.zip
>
>
> In the situation where I have a Person entity who has 2 different embedded addresses, like so:
> @Embedded
> @org.hibernate.envers.Audited
> @org.hibernate.envers.AuditJoinTable(name="JB_PSN_CORRESP_ADDRESS_AUD")
> private final List<CorrespondenceAdress> correspondenceAddresses;
> @Embedded
> @org.hibernate.envers.Audited
> @org.hibernate.envers.AuditJoinTable(name="JB_PSN_RESIDENTIAL_ADDRESS_AUD")
> private final List<ResidentialAdress> residentialAddresses;
> Where both CorrespondenceAdress and ResidentialAdress extend Address, which is an abstract MappedSuperclass
> @MappedSuperclass
> @org.hibernate.annotations.ForceDiscriminator
> @org.hibernate.envers.Audited
> public abstract class Adress
> I find that the AuditJoinTable annotation has no effect

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