我有DisseminationArea
以下Feature
代码的子类:
@Entity
@Table(name = "features")
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "subtype_id", discriminatorType = DiscriminatorType.INTEGER)
public class Feature {
@Id
@Column(name="id")
@GeneratedValue(generator="sqlite")
@TableGenerator(name="sqlite", table="sqlite_sequence",
pkColumnName="name", valueColumnName="seq",
pkColumnValue="features")
@Getter
@Setter
private long id;
@ManyToOne
@JoinColumn(name = "subtype_id")
@Getter
@Setter
private FeatureSubtype featureSubtype;
@ManyToOne
@JoinColumn(name = "parent_id")
@Getter
@Setter
private Feature parent;
...
}
不幸的是,当将此实体保存到数据库时,这会导致异常,因为subtype_id
字段被使用了两次。
我可以以某种方式对其进行注释,以便 JPA 知道它是同一个字段吗?