-
Notifications
You must be signed in to change notification settings - Fork 33
Backwards_compatibility_notes_for_0.5.5
HJIII-11 and HJIII-60 fixed default mappings for simple types. Since 0.5.5 you'll be getting more precise mappings for your simple types. For instance xsd:integer
was mapped with precision 19 and scale 2 (which does not make sense for integers, actually). Since 0.5.5 you'll be getting (20,0).
See Default mappings for single properties for a complete reference.
The 0.5.5 version corrects the bug where join columns in M:1 and M:M associations were internally referencing id columns of the entity on the wrong side of the relationship. This bug did not produce any erroneous behavior in versions prior to 0.5.5 since there was no support for composite keys. The only negative effect was the naming of the join columns.
The 0.5.5 version corrects this bug - but with the potential side-effect that names of join columns in M:1 and M:M associations may be changed as well. Consider the following schema fragment:
<xsd:complexType name="a">
<xsd:sequence>
<xsd:element name="aid" minOccurs="0" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<hj:id/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="b" minOccurs="0" type="test:b"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="b">
<xsd:sequence>
<xsd:element name="bid" minOccurs="0" type="xsd:string">
<xsd:annotation>
<xsd:appinfo>
<hj:id/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
Prior to 0.5.5 HJ3 generates the mapping for the property b
as follows:
@ManyToOne(targetEntity = B.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "B_A__AID")
public B getB() {
return b;
}
Note the B_A__AID
name of the join column. The last part (AID
) comes from the (incorrectly) referenced id field of the type A
. In this M:1 association this join column actually references the id field of the type B
. The 0.5.5 version corrects this mistake:
@ManyToOne(targetEntity = B.class, cascade = {
CascadeType.ALL
})
@JoinColumn(name = "B_A__BID")
public B getB() {
return b;
}
This correction changes, however, the generated name of join column (B_A_AID
vs. B_A
_BID
). The change only appears if names of id columns in the parent and child types differ (like AID
and BID
here). In this case database schema will not be backwards-compatible.