I have a simple JPA mapping but I keep getting a Could not determine type for
exception. Setters and getters are omitted.
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public class SupervisionCommand {
@Id
@GeneratedValue
protected Long id;
}
@Entity
public class MySupervisionCommand extends SupervisionCommand {
}
@Entity
public class Job {
@Id
@GeneratedValue
private Long id;
private SupervisionCommand command;
}
The full exception message: Could not determine type for: com.family.model.SupervisionCommand, at table: job, for columns: [org.hibernate.mapping.Column(command)]
You need a OneToOne or ManyToOne annotation (depending on the actual cardinality) on command:
@ManyToOne
private SupervisionCommand command;
The default mapping for fields is @Column
. And Hibernate doesn't know which type of column to use (varchar? number?) to store a SuperVisionCommand instance. If it implemented Serializable, Hibernate would serialize it and store it in a BLOB column, but this is not what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With