Hello,
I’m currently during Hibernate upgrade from 5.6 to 6.2.
After upgrade below code stopped working. I cannot find anything wrong with my code
@Entity
@Table(name = "order_linkage")
class OrderLink(
@EmbeddedId
var linkId: OrderLinkId? = null,
@Column
@field:CreationTimestamp
var creationTime: Timestamp? = null,
@ManyToOne
@MapsId("primaryOrderId")
@JsonIgnore
var primaryOrder: OrderEntity? = null,
@OneToOne
@MapsId("secondaryOrderId")
@JsonIgnore
var secondaryOrder: OrderEntity? = null
)
@Embeddable
class OrderLinkId(
@Column(name = "primary_order_id")
var primaryOrderId: Long? = null,
@Column(name = "secondary_order_id")
var secondaryOrderId: Long? = null
) : Serializable
@Entity
@Table(name = "order_entity")
@DiscriminatorColumn(name = "type")
@Inheritance(strategy = InheritanceType.JOINED)
abstract class OrderEntity(
...some fields
@OneToOne(mappedBy = "secondaryOrder", cascade = [CascadeType.ALL])
var primaryLink: OrderLink? = null,
@OneToMany(mappedBy = "primaryOrder", cascade = [CascadeType.ALL])
var secondaryLinks: MutableList<OrderLink>? = null
Error I’m getting is:
MappingException: broken column mapping for: primaryOrderId.id of: OrderEntityExtended