vu.do (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5e0db4b...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiNDg4ZDg3NGM2...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-14099?atlOrigin=eyJpIjoiNDg4ZD...
) HHH-14099 (
https://hibernate.atlassian.net/browse/HHH-14099?atlOrigin=eyJpIjoiNDg4ZD...
) Constraint.NO_CONSTRAINT has no effect on @ForeignKey for a @JoinTable or @JoinColumn in
@JoinTable (
https://hibernate.atlassian.net/browse/HHH-14099?atlOrigin=eyJpIjoiNDg4ZD...
)
Change By: vu.do (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=5e0db4b...
)
It is impossible to set Constraint.NO_CONSTRAINT for a @JoinColumn in @JoinTable. It will
generate a FK no matter what.
Error: Foreign key (FK3io8xbemymxv4bm5ccmh2ba8a:audience_sharing
\[audience_group_id,provider_id])) must have same number of columns as the referenced
primary key (audience_group \[audience_group_id])
I have tried all workaround but none works. The work arounds which applied the example
below:
{code:java}@JoinColumn(name = "provider_id", referencedColumnName =
"provider_id", foreignKey = @ForeignKey(value =
Constraint.NO_CONSTRAINT){code}
{noformat}@JoinColumn(name = "provider_id", referencedColumnName =
"provider_id", foreignKey = @ForeignKey(name = “none”, value =
Constraint.NO_CONSTRAINT){noformat}
{noformat}@JoinTable(
foreignKey = @ForeignKey(value = Constraint.NO_CONSTRAINT)
){noformat}
Example:
{code:java}@ManyToMany(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST,
CascadeType.MERGE, CascadeType.REFRESH, CascadeType.DETACH})
@JoinTable(
name = "sharing",
joinColumns = {
@JoinColumn(name = "audience_group_id", referencedColumnName =
"audience_group_id"),
@JoinColumn(name = "provider_id", referencedColumnName =
"provider_id", foreignKey = @ForeignKey(value = Constraint.NO_CONSTRAINT)),
},
inverseJoinColumns = @JoinColumn(name = "product_id")
)
@JsonManagedReference
private Set<Product> products = new HashSet<>(0);{code}
(
https://hibernate.atlassian.net/browse/HHH-14099#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-14099#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100131- sha1:aac02e2 )