Partially cached query

Daobab is able to resolve a situation where inner query regards to cached dao (any result entity list is cached dao as well)
So that inner query can be executed in-memory and only result can be appliet to the main query.

Query without cached inner query:

Select.fieldList(daoPizza.colName())
	.whereSelect(daoPizza.colPizzaId(),Operator.IN,
			Select.fieldList(daoOrderPizza.colPizzaId()).whereBetween(daoOrderPizza.colDeliverDate(), fromDate, toDate))
	.consumeEach(System.out::println);

Produced JPQL:

select md1.name  from Pizza md1 
	where md1.pizzaId  in  (select md1.pizzaId  from OrderPizza md1 where  ( md1.deliverDate  > '2018-01-01 00:00:00' and  md1.deliverDate  < '2018-07-01 00:00:00'))

Prepared cache:

CachedList ordersbuffer=Select.entityList(daoOrderPizza)
	.whereBetween(daoOrderPizza.colDeliverDate(), fromDate, toDate).result();

Inner query cached:

Select.fieldList(daoPizza.colName())
	.whereSelect(daoPizza.colPizzaId(),Operator.IN,
			Select.fieldList(ordersbuffer,daoOrderPizza.colPizzaId()).unique())
	.consumeEach(System.out::println);

Produced JPQL:

select md1.name  from Pizza md1 where md1.pizzaId  in ('3','5')

As you see, second JPQL points directly to IDs so that the database execution can be much faster.
Daobab execute in-memory any cached inner query and puts results into the main query.
However, using this approach, remember about SQL limitations. If ID list is too big, you can exceed the maximul SQL size allowed. In that case, avoid cached dao into inner query or simple disable cache by noCache() method.