我有一个简单的 JPA 映射,但我不断得到一个Could not determine type for
例外。 setter 和 getter 被省略。
@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;
}
完整的异常消息:Could not determine type for: com.family.model.SupervisionCommand, at table: job, for columns: [org.hibernate.mapping.Column(command)]
您需要在命令上使用 OneToOne 或 ManyToOne 注释(取决于实际基数):
@ManyToOne
private SupervisionCommand command;
字段的默认映射是@Column
。并且 Hibernate 不知道使用哪种类型的列(varchar?number?)来存储 SuperVisionCommand 实例。如果它实现了 Serialized,Hibernate 会将其序列化并将其存储在 BLOB 列中,但这不是您想要的。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)