Christian Beikov (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMTdkMDhjYzk1...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-14014?atlOrigin=eyJpIjoiMTdkMD...
) HHH-14014 (
https://hibernate.atlassian.net/browse/HHH-14014?atlOrigin=eyJpIjoiMTdkMD...
) ManyToMany referencing unique key doesn't work (
https://hibernate.atlassian.net/browse/HHH-14014?atlOrigin=eyJpIjoiMTdkMD...
)
Issue Type: Bug Affects Versions: 5.4.14 Assignee: Unassigned Components: hibernate-core
Created: 11/May/2020 10:05 AM Priority: Major Reporter: Christian Beikov (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
Mapping a `@ManyToMany` association doesn't work when using non-primary key columns
like in the following
@Entity
@Table(name = "animal" )
public class Animal implements Serializable {
@Id
@Column(name = "id" )
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@Column(name = "name" , nullable = false , unique = true )
private String name;
@Column(name = "ukey" , unique = true )
private String key;
@ManyToMany
@JoinTable(
name = "relatives" ,
joinColumns = @JoinColumn(name = "ukey1" , referencedColumnName =
"ukey" ),
inverseJoinColumns = @JoinColumn(name = "ukey2" ,
referencedColumnName = "ukey" )
)
private Set<Animal> relatives;
}
It fails with Duplicate property mapping of _org_hibernate_model_Animal_relatives found in
org.hibernate.model.Animal. I debugged a little and it seems two synthetic properties with
the same name are created. Maybe the synthetic property generation fails to see that
source and target are the same so it doesn't have to generate two synthetic
properties?
(
https://hibernate.atlassian.net/browse/HHH-14014#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-14014#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#100126- sha1:454696e )