2

私はactivejdbcで働いています:

私は 3 つのモデルを持っています: 都市は州に属し、国に属します。私はこれをします:

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

これにより、都市にその状態が読み込まれます (私は page.toMaps() を行います)。

国もロードしたい

それが可能だ?

4

1 に答える 1

0

このinclude()メソッドは、依存関係を 1 レベル上または下に移動します。これは、CIty のレベルから開始している場合は、状態しか取得できないことを意味します。両方を取得したい場合は、次のように 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 に答える