org.hibernate.mapping.BasicValue cannot be cast to class org.hibernate.mapping.ToOne
Issue
- The following mapping resulted in a ClassCastException:
@Entity
static class Loan {
@Id
@Column(name = "LOAN_ID")
private Long id;
@OneToMany(cascade = PERSIST, mappedBy = "exLoanId")
private List<Extensions> extensions = new ArrayList<>();
}
@Entity
static class Extensions {
@Id
@Column(name = "EX_LOAN_ID")
private Long exLoanId;
@Id
@Column(name = "EX_NO")
private Long exNo;
@Column(name = "EX_EXTENSION_DAYS")
private Long exExtensionDays;
}
- Following ERROR message is showing in log:
Caused by: 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 'org.hibernate@6.2.13.Final-redhat-00001' @74e9b06d)
...
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 8.0.0
- QUARKUS
- 3.2.9
- Hibernate ORM
- 6.2.13
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.