Marius K (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=70121%3...
) *updated* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZjg4NjYyOWEw...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16437?atlOrigin=eyJpIjoiZjg4Nj...
) HHH-16437 (
https://hibernate.atlassian.net/browse/HHH-16437?atlOrigin=eyJpIjoiZjg4Nj...
) class org.hibernate.mapping.BasicValue cannot be cast to class
org.hibernate.mapping.ToOne (
https://hibernate.atlassian.net/browse/HHH-16437?atlOrigin=eyJpIjoiZjg4Nj...
)
Change By: Marius K (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=70121%3...
)
Hi,
I have a One-To-Many relation with the Many-entity having an composite id with
AttributeOverrides. This works fine with 6.2.0-CR3 ( and 5), but starts failing with CR4.
{noformat}java.lang.ClassCastException: class org.hibernate.mapping.BasicValue cannot be
cast to class org.hibernate.mapping.ToOne (org.hibernate.mapping.BasicValue and
org.hibernate.mapping.ToOne are in unnamed module of loader 'app'){noformat}
I attached a test case.
[^hibernate-orm-6.zip]
{noformat}@Entity
public class Contract implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private Integer contractId;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy =
"id.contractId")
@OrderBy(value = "id.positionNumber")
private List<Contractposition> contractpositions = new
ArrayList<>();{noformat}
{noformat}@Entity
public class Contractposition implements Serializable {
private static final long serialVersionUID = 1L;
@EmbeddedId
@AttributeOverrides(
{
@AttributeOverride(name = "contractId", column = @Column(name =
"VERTRAG_ID", nullable = false)),
@AttributeOverride(name = "positionNumber", column = @Column(name =
"POSITIONSNUMMER", nullable = false))})
private ContractpositionId id;{noformat}
{noformat}@Embeddable
public class ContractpositionId implements Serializable {
private static final long serialVersionUID = 1L;
@Column(name = "VERTRAG_ID", nullable = false)
private Integer contractId;
@Column(name = "POSITIONSNUMMER", nullable = false)
private int positionNumber;{noformat}
Debugging shows:
!image-20230405-073033.png|width=869,height=476!
(
https://hibernate.atlassian.net/browse/HHH-16437#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16437#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#100221- sha1:78e8bd6 )