Search in sources :

Example 1 with DocumentSimpleCorrelationViewJoinId

use of com.blazebit.persistence.view.testsuite.correlation.expression.model.DocumentSimpleCorrelationViewJoinId in project blaze-persistence by Blazebit.

the class ExpressionCorrelationTest method testFilterSortJoinCorrelatedSingularBasicPaginated.

@Test
// @Category({ NoHibernate42.class, NoHibernate43.class, NoHibernate50.class, NoDatanucleus4.class, NoOpenJPA.class, NoEclipselink.class })
@Category({ NoHibernate42.class, NoHibernate43.class, NoHibernate50.class, NoDatanucleus.class, NoOpenJPA.class, NoEclipselink.class })
public void testFilterSortJoinCorrelatedSingularBasicPaginated() {
    EntityViewManager evm = buildEntityViewManagerForFilter();
    CriteriaBuilder<Document> criteria = cbf.create(em, Document.class, "d");
    EntityViewSetting<DocumentSimpleCorrelationViewJoinId, PaginatedCriteriaBuilder<DocumentSimpleCorrelationViewJoinId>> setting;
    setting = EntityViewSetting.create(DocumentSimpleCorrelationViewJoinId.class, 0, 1);
    setting.addAttributeFilter("correlatedOwnerId", doc2.getOwner().getId());
    setting.addAttributeSorter("correlatedOwnerId", Sorters.ascending());
    setting.addAttributeSorter("id", Sorters.ascending());
    PaginatedCriteriaBuilder<DocumentSimpleCorrelationViewJoinId> cb = evm.applySetting(setting, criteria);
    PagedList<DocumentSimpleCorrelationViewJoinId> results = cb.getResultList();
    assertEquals(1, results.size());
    assertEquals(3, results.getTotalSize());
}
Also used : EntityViewManager(com.blazebit.persistence.view.EntityViewManager) DocumentSimpleCorrelationViewJoinId(com.blazebit.persistence.view.testsuite.correlation.expression.model.DocumentSimpleCorrelationViewJoinId) Document(com.blazebit.persistence.testsuite.entity.Document) PaginatedCriteriaBuilder(com.blazebit.persistence.PaginatedCriteriaBuilder) Category(org.junit.experimental.categories.Category) Test(org.junit.Test) AbstractCorrelationTest(com.blazebit.persistence.view.testsuite.correlation.AbstractCorrelationTest)

Example 2 with DocumentSimpleCorrelationViewJoinId

use of com.blazebit.persistence.view.testsuite.correlation.expression.model.DocumentSimpleCorrelationViewJoinId in project blaze-persistence by Blazebit.

the class ExpressionCorrelationTest method testFilterSortJoinCorrelatedPluralBasicPaginated.

@Test
// @Category({ NoHibernate42.class, NoHibernate43.class, NoHibernate50.class, NoDatanucleus4.class, NoOpenJPA.class, NoEclipselink.class })
@Category({ NoHibernate42.class, NoHibernate43.class, NoHibernate50.class, NoDatanucleus.class, NoOpenJPA.class, NoEclipselink.class })
public void testFilterSortJoinCorrelatedPluralBasicPaginated() {
    EntityViewManager evm = buildEntityViewManagerForFilter();
    CriteriaBuilder<Document> criteria = cbf.create(em, Document.class, "d");
    EntityViewSetting<DocumentSimpleCorrelationViewJoinId, PaginatedCriteriaBuilder<DocumentSimpleCorrelationViewJoinId>> setting;
    setting = EntityViewSetting.create(DocumentSimpleCorrelationViewJoinId.class, 0, 1);
    setting.addAttributeFilter("correlatedOwnerIdList", doc2.getOwner().getId());
    setting.addAttributeSorter("correlatedOwnerIdList", Sorters.ascending());
    setting.addAttributeSorter("id", Sorters.ascending());
    PaginatedCriteriaBuilder<DocumentSimpleCorrelationViewJoinId> cb = evm.applySetting(setting, criteria);
    PagedList<DocumentSimpleCorrelationViewJoinId> results = cb.getResultList();
    assertEquals(1, results.size());
    assertEquals(3, results.getTotalSize());
}
Also used : EntityViewManager(com.blazebit.persistence.view.EntityViewManager) DocumentSimpleCorrelationViewJoinId(com.blazebit.persistence.view.testsuite.correlation.expression.model.DocumentSimpleCorrelationViewJoinId) Document(com.blazebit.persistence.testsuite.entity.Document) PaginatedCriteriaBuilder(com.blazebit.persistence.PaginatedCriteriaBuilder) Category(org.junit.experimental.categories.Category) Test(org.junit.Test) AbstractCorrelationTest(com.blazebit.persistence.view.testsuite.correlation.AbstractCorrelationTest)

Example 3 with DocumentSimpleCorrelationViewJoinId

use of com.blazebit.persistence.view.testsuite.correlation.expression.model.DocumentSimpleCorrelationViewJoinId in project blaze-persistence by Blazebit.

the class ExpressionCorrelationTest method testFilterSortJoinCorrelatedPluralViewPaginated.

@Test
// @Category({ NoHibernate42.class, NoHibernate43.class, NoHibernate50.class, NoDatanucleus4.class, NoOpenJPA.class, NoEclipselink.class })
@Category({ NoHibernate42.class, NoHibernate43.class, NoHibernate50.class, NoDatanucleus.class, NoOpenJPA.class, NoEclipselink.class })
public void testFilterSortJoinCorrelatedPluralViewPaginated() {
    EntityViewManager evm = buildEntityViewManagerForFilter();
    CriteriaBuilder<Document> criteria = cbf.create(em, Document.class, "d");
    EntityViewSetting<DocumentSimpleCorrelationViewJoinId, PaginatedCriteriaBuilder<DocumentSimpleCorrelationViewJoinId>> setting;
    setting = EntityViewSetting.create(DocumentSimpleCorrelationViewJoinId.class, 0, 1);
    setting.addAttributeFilter("correlatedOwnerViewList.name", "PERS2");
    setting.addAttributeSorter("correlatedOwnerViewList.name", Sorters.ascending());
    setting.addAttributeSorter("id", Sorters.ascending());
    PaginatedCriteriaBuilder<DocumentSimpleCorrelationViewJoinId> cb = evm.applySetting(setting, criteria);
    PagedList<DocumentSimpleCorrelationViewJoinId> results = cb.getResultList();
    assertEquals(1, results.size());
    assertEquals(3, results.getTotalSize());
}
Also used : EntityViewManager(com.blazebit.persistence.view.EntityViewManager) DocumentSimpleCorrelationViewJoinId(com.blazebit.persistence.view.testsuite.correlation.expression.model.DocumentSimpleCorrelationViewJoinId) Document(com.blazebit.persistence.testsuite.entity.Document) PaginatedCriteriaBuilder(com.blazebit.persistence.PaginatedCriteriaBuilder) Category(org.junit.experimental.categories.Category) Test(org.junit.Test) AbstractCorrelationTest(com.blazebit.persistence.view.testsuite.correlation.AbstractCorrelationTest)

Example 4 with DocumentSimpleCorrelationViewJoinId

use of com.blazebit.persistence.view.testsuite.correlation.expression.model.DocumentSimpleCorrelationViewJoinId in project blaze-persistence by Blazebit.

the class ExpressionCorrelationTest method testFilterSortJoinCorrelatedSingularViewPaginated.

@Test
// @Category({ NoHibernate42.class, NoHibernate43.class, NoHibernate50.class, NoDatanucleus4.class, NoOpenJPA.class, NoEclipselink.class })
@Category({ NoHibernate42.class, NoHibernate43.class, NoHibernate50.class, NoDatanucleus.class, NoOpenJPA.class, NoEclipselink.class })
public void testFilterSortJoinCorrelatedSingularViewPaginated() {
    EntityViewManager evm = buildEntityViewManagerForFilter();
    CriteriaBuilder<Document> criteria = cbf.create(em, Document.class, "d");
    EntityViewSetting<DocumentSimpleCorrelationViewJoinId, PaginatedCriteriaBuilder<DocumentSimpleCorrelationViewJoinId>> setting;
    setting = EntityViewSetting.create(DocumentSimpleCorrelationViewJoinId.class, 0, 1);
    setting.addAttributeFilter("correlatedOwnerView.name", "PERS2");
    setting.addAttributeSorter("correlatedOwnerView.name", Sorters.ascending());
    setting.addAttributeSorter("id", Sorters.ascending());
    PaginatedCriteriaBuilder<DocumentSimpleCorrelationViewJoinId> cb = evm.applySetting(setting, criteria);
    PagedList<DocumentSimpleCorrelationViewJoinId> results = cb.getResultList();
    assertEquals(1, results.size());
    assertEquals(3, results.getTotalSize());
}
Also used : EntityViewManager(com.blazebit.persistence.view.EntityViewManager) DocumentSimpleCorrelationViewJoinId(com.blazebit.persistence.view.testsuite.correlation.expression.model.DocumentSimpleCorrelationViewJoinId) Document(com.blazebit.persistence.testsuite.entity.Document) PaginatedCriteriaBuilder(com.blazebit.persistence.PaginatedCriteriaBuilder) Category(org.junit.experimental.categories.Category) Test(org.junit.Test) AbstractCorrelationTest(com.blazebit.persistence.view.testsuite.correlation.AbstractCorrelationTest)

Aggregations

PaginatedCriteriaBuilder (com.blazebit.persistence.PaginatedCriteriaBuilder)4 Document (com.blazebit.persistence.testsuite.entity.Document)4 EntityViewManager (com.blazebit.persistence.view.EntityViewManager)4 AbstractCorrelationTest (com.blazebit.persistence.view.testsuite.correlation.AbstractCorrelationTest)4 DocumentSimpleCorrelationViewJoinId (com.blazebit.persistence.view.testsuite.correlation.expression.model.DocumentSimpleCorrelationViewJoinId)4 Test (org.junit.Test)4 Category (org.junit.experimental.categories.Category)4