use of com.blazebit.persistence.testsuite.entity.DocumentForOneToOne in project blaze-persistence by Blazebit.
the class SingleValuedAssociationOneToOneJoinTableTest method leftJoinDereferenedForeignJoinTableWithTableGroupJoins.
@Test
@Category({ NoDatanucleus.class, NoEclipselink.class, NoOpenJPA.class, NoHibernate42.class, NoHibernate43.class, NoHibernate50.class })
public void leftJoinDereferenedForeignJoinTableWithTableGroupJoins() {
Assume.assumeTrue(supportsTableGroupJoins());
CriteriaBuilder criteriaBuilder = cbf.create(em, DocumentForOneToOneJoinTable.class, "d").leftJoinOn(DocumentForOneToOne.class, "e").on("d.documentInfoJoinTable.id").eqExpression("e.id").end();
assertEquals("SELECT d FROM DocumentForOneToOneJoinTable d LEFT JOIN DocumentForOneToOne e ON (d.documentInfoJoinTable.id = e.id)", criteriaBuilder.getQueryString());
criteriaBuilder.getResultList();
}
use of com.blazebit.persistence.testsuite.entity.DocumentForOneToOne in project blaze-persistence by Blazebit.
the class SingleValuedAssociationOneToOneJoinTableTest method leftJoinDereferenedForeignJoinTable.
@Test
@Category({ NoDatanucleus.class, NoEclipselink.class, NoOpenJPA.class, NoHibernate51.class, NoHibernate52.class, NoHibernate53.class })
public void leftJoinDereferenedForeignJoinTable() {
Assume.assumeFalse(supportsTableGroupJoins());
Assume.assumeTrue(jpaProvider.supportsEntityJoin());
CriteriaBuilder criteriaBuilder = cbf.create(em, DocumentForOneToOneJoinTable.class, "d").leftJoinOn(DocumentForOneToOne.class, "e").on("d.documentInfoJoinTable.id").eqExpression("e.id").end();
assertEquals("SELECT d FROM DocumentForOneToOneJoinTable d LEFT JOIN DocumentForOneToOne e ON (EXISTS (SELECT 1 FROM d.documentInfoJoinTable _synth_subquery_0 WHERE _synth_subquery_0.id = e.id))", criteriaBuilder.getQueryString());
criteriaBuilder.getResultList();
}
use of com.blazebit.persistence.testsuite.entity.DocumentForOneToOne in project blaze-persistence by Blazebit.
the class PaginationOneToOneTest method setUpOnce.
@Override
public void setUpOnce() {
cleanDatabase();
transactional(new TxVoidWork() {
@Override
public void work(EntityManager em) {
DocumentForOneToOne doc1 = new DocumentForOneToOne("doc1");
DocumentForOneToOne doc2 = new DocumentForOneToOne("doc2");
Person p1 = new Person("owner");
doc1.setOwner(p1);
doc2.setOwner(p1);
DocumentInfo o1 = new DocumentInfo(1L, doc2, "Karl1");
DocumentInfo o2 = new DocumentInfo(2L, doc1, "Karl2");
em.persist(p1);
em.persist(doc1);
em.persist(doc2);
em.persist(o1);
em.persist(o2);
}
});
}
Aggregations