[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3729?page=c...
]
Erik-Berndt Scheper commented on HHH-3729:
------------------------------------------
OK, it took me some time to reproduce this. I think some explanation is required for this
testcase, as it is quite elaborate.
The main test class to be called is VersionsJoinTableRangeComponentNamingTest.java
*The test persists an instance of VersionsJoinTableRangeComponentTestEntity.java (the main
entity).
*This entity contains two embedded components of type VersionsJoinTableRangeComponent.
*The embedded component contains a property 'range' which is a List of
Entity-instances.
*All properties of these entities are audited. Because of the List inside the component,
envers generates two audit join tables. This is correct.
Ultimately, what I want to achieve is to rename these audit join tables, using the Envers
@AuditJoinTable annotation.
This works perfectly fine in simple cases, but not here. Understandably, I cannot add the
@AuditJoinTable to the component, because that leads to an
"org.hibernate.DuplicateMappingException: Duplicate class/entity mapping",
because the component is used twice.
For JoinColumns, there is the JPA standard annotation
@AssociationOverride(name="range", joinColumns={@JoinColumn(name =
"VJTRCTE1_ID", insertable = true, updatable = false, nullable = false)})
which I use in the 'main' entity.
My original report meant to say that the following @AuditJoinTable annotation to the
entity has no effect (as demonstrated in the testcase).
@org.hibernate.envers.AuditJoinTable(name = "JOIN_TABLE_COMPONENT_1_AUD",
inverseJoinColumns = @JoinColumn(name = "VJTRTE_ID")
However, to maintain consistency with the JPA-spec, I now believe is that we need an extra
annotation for the override, like so
@AuditJoinTableOverride(name="range",
auditJoinTable=(a)org.hibernate.envers.AuditJoinTable(name =
"JOIN_TABLE_COMPONENT_1_AUD", inverseJoinColumns = @JoinColumn(name =
"VJTRTE_ID"))
But I am open to all suggestions.
@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.4
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira