diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SamplePE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SamplePE.java index 647eb99112804ce2d73096f89e7ed581ac836d0c..f74d8b09c8838e523721747c1448371318f19874 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SamplePE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SamplePE.java @@ -50,6 +50,7 @@ import org.hibernate.annotations.Cascade; import org.hibernate.annotations.Check; import org.hibernate.annotations.Generated; import org.hibernate.annotations.GenerationTime; +import org.hibernate.search.annotations.ContainedIn; import org.hibernate.search.annotations.DocumentId; import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.Index; @@ -145,6 +146,45 @@ public class SamplePE implements IIdAndCodeHolder, Comparable<SamplePE>, private Date modificationDate; + // ------------- + // These methods are here only to make the Hibernate Search working. They should not be + // used as they do not maintain the bidirectional connections properly + // ------------- + + private Set<DataPE> acquiredDatasets = new HashSet<DataPE>(); + + private Set<DataPE> derivedDatasets = new HashSet<DataPE>(); + + @SuppressWarnings("unused") + @OneToMany(fetch = FetchType.LAZY, mappedBy = "sampleAcquiredFrom") + @ContainedIn + private Set<DataPE> getAcquiredDatasets() + { + return acquiredDatasets; + } + + @SuppressWarnings("unused") + private void setAcquiredDatasets(Set<DataPE> acquiredDatasets) + { + this.acquiredDatasets = acquiredDatasets; + } + + @SuppressWarnings("unused") + @OneToMany(fetch = FetchType.LAZY, mappedBy = "sampleDerivedFrom") + @ContainedIn + private Set<DataPE> getDerivedDatasets() + { + return derivedDatasets; + } + + @SuppressWarnings("unused") + private void setDerivedDatasets(Set<DataPE> derivedDatasets) + { + this.derivedDatasets = derivedDatasets; + } + + // -------------------- + @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = ColumnNames.INVALIDATION_COLUMN) public InvalidationPE getInvalidation()