Search in sources :

Example 6 with DefaultKeyset

use of com.blazebit.persistence.DefaultKeyset in project blaze-persistence by Blazebit.

the class PaginationTest method testExtractIdQueryKeysetPageNonOptimized.

@Test
public void testExtractIdQueryKeysetPageNonOptimized() {
    CriteriaBuilder<Tuple> pcb = cbf.create(em, Tuple.class).from(Document.class, "d").select("id").select("contacts[1].name").where("name").eq("doc1").orderByAsc("d.id").setProperty(ConfigurationProperties.OPTIMIZED_KEYSET_PREDICATE_RENDERING, "false");
    CriteriaBuilder<Object[]> idQuery = pcb.createPageIdQuery(new DefaultKeysetPage(0, 10, null, new DefaultKeyset(new Serializable[] { 10L })), 10, 10, "d.id");
    assertEquals("SELECT d.id FROM Document d WHERE d.name = :param_0 AND (d.id > :_keysetParameter_0) ORDER BY d.id ASC", idQuery.getQueryString());
    idQuery.getResultList();
}
Also used : DefaultKeysetPage(com.blazebit.persistence.DefaultKeysetPage) DefaultKeyset(com.blazebit.persistence.DefaultKeyset) Tuple(javax.persistence.Tuple) Test(org.junit.Test)

Aggregations

DefaultKeyset (com.blazebit.persistence.DefaultKeyset)6 DefaultKeysetPage (com.blazebit.persistence.DefaultKeysetPage)5 KeysetPage (com.blazebit.persistence.KeysetPage)4 Serializable (java.io.Serializable)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 KeysetPageRequest (com.blazebit.persistence.spring.data.repository.KeysetPageRequest)2 KeysetPageable (com.blazebit.persistence.spring.data.repository.KeysetPageable)2 Method (java.lang.reflect.Method)2 Pageable (org.springframework.data.domain.Pageable)2 KeysetPageRequest (com.blazebit.persistence.deltaspike.data.KeysetPageRequest)1 PageRequest (com.blazebit.persistence.deltaspike.data.PageRequest)1 Pageable (com.blazebit.persistence.deltaspike.data.Pageable)1 Sort (com.blazebit.persistence.deltaspike.data.Sort)1 KeysetConfig (com.blazebit.persistence.spring.data.webflux.KeysetConfig)1 KeysetConfig (com.blazebit.persistence.spring.data.webmvc.KeysetConfig)1 Tuple (javax.persistence.Tuple)1 Test (org.junit.Test)1