我有一个实体集团记录具有复合代码BlocRecordId,并且在其复合代码中有一个@Embedded(关系代码ManyToOne)指向另一个原始记录并希望审核实体集团记录。
实体集团记录
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "blocRecord")
@Access(value = AccessType.FIELD)
@Audited
public class BlocRecord {
@EmbeddedId
private BlocRecordId blocRecordId = new BlocRecordId();
@ManyToOne(fetch = FetchType.LAZY, optional = false)
@JoinColumns({
@JoinColumn(name = "record_identifier_", referencedColumnName = "identifier_", unique = false, nullable = false),
@JoinColumn(name = "record_recordType_", referencedColumnName = "recordType_", unique = false, nullable = false)})
@MapsId("record")
private Record record;
...
}
标识类块记录 ID
@Embeddable
public class BlocRecordId implements Serializable {
@Embedded
private RecordId record;
@Column(name = "source_")
String source ;
@Column(name = "messageType_")
String messageType ;
实体记录
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "records")
@Access(value = AccessType.FIELD)
@Audited
public class Record {
@EmbeddedId
private RecordId recordId = new RecordId();
@OneToMany(targetEntity = BlocRecord.class, fetch = FetchType.LAZY, mappedBy = "record")
private Set<BlocRecord> blocRecord = new java.util.HashSet<>();
...
}
实体记录的 id 类
@Embeddable
public class RecordId implements Serializable{
@Column(name = "identifier_")
String identifier ;
@Column(name = "recordType_")
String recordType ;
}
休眠 -envers 在尝试在可嵌入的 BlocRecordId 中生成字段记录的元数据时失败,引发流动异常
您知道如何解决问题吗?
猛跑小猪
相关分类