[hibernate-issues] [JIRA] (HHH-14014) ManyToMany referencing unique key doesn't work
Christian Beikov (JIRA)
jira at hibernate.atlassian.net
Mon May 11 13:05:28 EDT 2020
Christian Beikov ( https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A0222998d-a0c8-4789-91ec-6a92d10dfb9a ) *created* an issue
Hibernate ORM ( https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiMTdkMDhjYzk1ZTBlNGQyNWFhY2JmZWRkMDY2NTFhNjIiLCJwIjoiaiJ9 ) / Bug ( https://hibernate.atlassian.net/browse/HHH-14014?atlOrigin=eyJpIjoiMTdkMDhjYzk1ZTBlNGQyNWFhY2JmZWRkMDY2NTFhNjIiLCJwIjoiaiJ9 ) HHH-14014 ( https://hibernate.atlassian.net/browse/HHH-14014?atlOrigin=eyJpIjoiMTdkMDhjYzk1ZTBlNGQyNWFhY2JmZWRkMDY2NTFhNjIiLCJwIjoiaiJ9 ) ManyToMany referencing unique key doesn't work ( https://hibernate.atlassian.net/browse/HHH-14014?atlOrigin=eyJpIjoiMTdkMDhjYzk1ZTBlNGQyNWFhY2JmZWRkMDY2NTFhNjIiLCJwIjoiaiJ9 )
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%3A0222998d-a0c8-4789-91ec-6a92d10dfb9a )
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=eyJpIjoiMTdkMDhjYzk1ZTBlNGQyNWFhY2JmZWRkMDY2NTFhNjIiLCJwIjoiaiJ9 ) Add Comment ( https://hibernate.atlassian.net/browse/HHH-14014#add-comment?atlOrigin=eyJpIjoiMTdkMDhjYzk1ZTBlNGQyNWFhY2JmZWRkMDY2NTFhNjIiLCJwIjoiaiJ9 )
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.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail ) or iOS ( https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8 ) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100126- sha1:454696e )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-issues/attachments/20200511/161bb914/attachment.html
More information about the hibernate-issues
mailing list