Marius K (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=70121%3...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZTFjYTM5NWVj...
) / Bug (
https://hibernate.atlassian.net/browse/HHH-16437?atlOrigin=eyJpIjoiZTFjYT...
) HHH-16437 (
https://hibernate.atlassian.net/browse/HHH-16437?atlOrigin=eyJpIjoiZTFjYT...
) class org.hibernate.mapping.BasicValue cannot be cast to class
org.hibernate.mapping.ToOne (
https://hibernate.atlassian.net/browse/HHH-16437?atlOrigin=eyJpIjoiZTFjYT...
)
Issue Type: Bug Affects Versions: 6.2.0.CR4, 6.2.0 Assignee: Unassigned Attachments:
hibernate-orm-6.zip, image-20230405-073033.png Components: hibernate-core Created:
05/Apr/2023 00:34 AM Priority: Major Reporter: 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 starts failing with CR4.
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')
I attached a test case.
hibernate-orm-6.zip (
https://hibernate.atlassian.net/secure/attachment/50293/50293_hibernate-o... )
@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<>();
@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;
@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;
Debugging shows:
(
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 )