Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Entity
- public class Samples {
- @EmbeddedId
- public SampleId id;
- @MapsId("samplingId")
- @ManyToOne(optional = false)
- private Samplings sampling;
- @OneToOne(mappedBy = "sample", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
- private TestSamples testSamples;
- }
- @Entity
- public class TestSamples {
- @Id
- @SequenceGenerator(name = "test_samples_id_seq", sequenceName = "test_samples_id_seq", allocationSize = 1)
- @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "test_samples_id_seq")
- private Integer id;
- @OneToOne(fetch = FetchType.LAZY)
- private Samples sample;
- private boolean compression;
- @OneToOne(mappedBy = "testSample", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
- private Compressions compressionTest;
- ...
- }
- select s from Samples s
- Join Fetch s.testSamples ts
- Left Join Fetch ts.compressionTest ct
- Join fetch s.sampling sp
- Left Join fetch sp.machine m
- Join fetch sp.product p
- Join fetch p.productType pt
- where
- ts.compressionTest.done=false
Add Comment
Please, Sign In to add comment