Envers auditReader.find() returns wrong data for embedded components using fields with
default values
-----------------------------------------------------------------------------------------------------
Key: HHH-5288
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5288
Project: Hibernate Core
Issue Type: Bug
Components: envers
Affects Versions: 3.5.2, 3.5.1, 3.5.0-Final
Reporter: Erik-Berndt Scheper
I have found that using auditReader.find() to retrieve audit information for entities
containing embedded components with default values. This is a regression issue (also
occurs in 1.2.2.GA release of Envers - Hibernate 3.3 compatible, but did not occur not in
1.2.1 GA) that started occurring since HHH-3957.
Sample entity and embeddable:
{code:title=DefaultValueComponentTestEntity.java|borderStyle=solid}
@Id
@GeneratedValue
private Integer id;
@Embedded
@Audited
@AttributeOverrides( { @AttributeOverride(name = "comp2.str1", column =
@Column(name = "COMP2_STR1")) })
private DefaultValueComponent1 comp1 = null;
{code}
{code:title=DefaultValueComponent1.java|borderStyle=solid}
private String str1;
@Embedded
private DefaultValueComponent2 comp2 = new DefaultValueComponent2();
{code}
{code:title=DefaultValueComponent2.java|borderStyle=solid}
private String str1 = "defaultValue";
private String str2;
{code}
When I try to persist an instance of DefaultValueComponentTestEntity, with comp1 = null
and subsequently call auditReader.find(), an instance is returned where:
{noformat} "defaultValue".equals(comp1.comp2.str1){noformat}
(using java bean notation for simplicity).
I will attach a complete testcase.
--
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