Christian Beikov (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZTljNWI5MTQx...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16370?atlOrigin=eyJpIjoiZTljNW...
) HHH-16370 (
https://hibernate.atlassian.net/browse/HHH-16370?atlOrigin=eyJpIjoiZTljNW...
) Using MapKey on ManyToMany leads to wrong insert SQL (
https://hibernate.atlassian.net/browse/HHH-16370?atlOrigin=eyJpIjoiZTljNW...
)
Issue Type: Bug Affects Versions: 6.2.0.CR4 Assignee: Unassigned Components:
hibernate-core Created: 24/Mar/2023 12:02 PM Priority: Major Reporter: Christian Beikov (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
The model is:
@Entity(name = "MapContainer" )
@Table(name = "map_container" )
public static class MapContainer {
@Id
private Long id;
@ManyToMany
@MapKey(name = "mapKey" )
private Map<MapKeyEntity, MapValueEntity> map = new HashMap<>();
public MapContainer() { }
public MapContainer( Long id) {
this.id = id;
}
}
@Entity(name = "MapKeyEntity" )
@Table(name = "map_key_entity" )
public static class MapKeyEntity {
@Id
private Long id;
public MapKeyEntity() { }
public MapKeyEntity( Long id) {
this.id = id;
}
}
@Entity(name = "MapValueEntity" )
@Table(name = "map_value_entity" )
public static class MapValueEntity {
@Id
private Long id;
@ManyToOne(optional = false )
private MapContainer mapContainer;
@ManyToOne(optional = false )
@JoinColumn(unique = true )
private MapKeyEntity mapKey;
public MapValueEntity() { }
public MapValueEntity( Long id) {
this.id = id;
}
}
I don’t know if @MapKey makes sense here or what 5 did, but it worked before.
(
https://hibernate.atlassian.net/browse/HHH-16370#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16370#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#100219- sha1:ac3e918 )