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! |
|