Bug 1003468
| Summary: | HHH-8464 Using JPA2 specific quoting character (double quote) for JoinColumn results in DuplicateMappingException. | ||
|---|---|---|---|
| Product: | [JBoss] JBoss Enterprise Application Platform 6 | Reporter: | dstephan |
| Component: | Hibernate | Assignee: | Brett Meyer <brmeyer> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Zbyněk Roubalík <zroubali> |
| Severity: | unspecified | Docs Contact: | Russell Dickenson <rdickens> |
| Priority: | unspecified | ||
| Version: | 6.1.0 | CC: | brmeyer, dstephan, lcosti, msimka, myarboro, theute |
| Target Milestone: | ER4 | ||
| Target Release: | EAP 6.2.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: |
Using a JPA2-specific quoting character (`"`) for a JoinColumn would result in a `DuplicateMappingException`. This issue was caused by the quoting character not being normalized internally.
This issue has been fixed in this release so that using `"` for a JoinColumn is now normalized properly, and will no longer result a `DuplicateMappingException`.
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | 2013-12-15 16:14:23 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1010467 | ||
Hibernate Jira : https://hibernate.atlassian.net/browse/HHH-8464 As described on HHH-8464:
Dave, the mapping looks off (I think). In the test case, OutboundDistributorEligibility has the following:
@Id
@Column(name = "\"WETRN#\"", precision = 9, scale = 0)
private BigInteger transactionNumber;
...
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="\"WETRN#\"", insertable=false, updatable=false)
private OutboundNewDistributorTransaction transaction;
That would try to create 2 physical columns with the "WETRN#" name. It looks to me like they're trying to define a derived primary key from the many-to-one OutboundNewDistributorTransaction foreign key (ie, the OutboundDistributorEligibility PK is the same as its FK referring to to OutboundNewDistributorTransaction). Instead, try this:
Completely remove OutboundDistributorEligibility#transactionNumber. Add @Id to OutboundDistributorEligibility#transaction. OutboundDistributorEligibility.OutboundDistributorEligibilityPK will also need updated to refer to "transaction" instead of "transactionNumber".
Please give that a shot first. I'll leave this open for now.
Dave, regardless of the mapping, there was a legitimate issue. Corrected upstream in HHH-8464. Do they need a one-off, or is this purely the permanent fix? If one-off, create an additional BZ? Assuming this is the permanent fix (EAP 6.3.0). Dave, open a one-off if needed. Dave stated a one-off wasn't needed -- easy workarounds are acceptable. Actually, this will go into EAP 6.2.0 ER4's upgrade to Hibernate ORM 4.2.6.Final in 1010467. verified on EAP 6.2.0.CR2 |
A JoinColumn like the following: @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="\"NAME#\"", insertable=false, updatable=false) private OutTx transaction; will result in: org.hibernate.DuplicateMappingException: Table [XYZ contains phyical column name `NAME#` represented by different logical column names: `NAME#`, "NAME#" It seems like these lines in EJB3JoinColumn.addColumnBinding() won't replace the mapping with backticks: if ( StringHelper.isQuoted( getLogicalColumnName() ) || StringHelper.isQuoted( getLogicalColumnName() ) ) { logicalColumnName = StringHelper.quote( logicalColumnName ); }