我有一个这样的表格设置:
public class SampleMetricAggregation {
@Id
@Column(name="SAMPLE_METRIC_AGGR_ID")
protected Long id;
@OneToOne(fetch=FetchType.LAZY, mappedBy="sampleMetricAggrId")
@Where(clause="SCOPE='EXON' and PARTITION='ALL' and TYPE='RAW'")
protected CoverageCalculation exonCoverageCalculation;
和
@Entity
@Table(name="COVERAGE_CALCULATION")
public class CoverageCalculation {
@Id
@SequenceGenerator(name="CURATION_CALC_SEQ", sequenceName="CURATION_CALC_SEQ", allocationSize=1)
@Column(name="COVERAGE_CALCULATION_ID")
protected Long id;
@OneToOne(fetch=FetchType.LAZY)
@JoinColumn(name="SAMPLE_METRIC_AGGR_ID")
protected SampleMetricAggregation sampleMetricAggrId;
从SampleMetricAggr到CoverageCalc的关系是一对多的(可能有许多具有相同ID的CoverageCalcs),但是我希望能够基于@Where批注中的过滤条件来获得特定的联系。
冬眠能处理这个吗?在我的测试中,我收到了来自“发现具有给定标识符的多行”错误。
谢谢