use of com.blazebit.persistence.PaginatedCriteriaBuilder 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());
}
Aggregations