2

I'm work with activejdbc and:

I have 3 Models: City belongs to State belongs to Country, ok? I do this:

Paginator p = new Paginator(City.class, count, filters).orderBy(orderParams); LazyList page = p.getPage(pag).include(State.class);

This, loads cities with their states (i do page.toMaps()),

Now I want to load the country also

It's possible?

4

1 回答 1

0

include()方法仅对依赖关系进行向上或向下一级。这意味着如果你从城市级别开始,你只能得到一个状态。如果你想两者兼得,你可以从 State 级别开始,如下所示:

Paginator p = new Paginator(State.class, count, filters) 
                                       .orderBy(orderParams); 
LazyList page = p.getPage(pag).include(City.class, Country.class);

不过,不确定这是否适合您。这是一个没有分页器的例子: http ://javalite.io/lazy_and_eager#eager-simultaneous-loading-of-parents-and-children

于 2016-04-14T22:18:02.830 回答