java - ForeignCollection auto load with queryRaw() -
i have card
class, has eager foreigncollection
in it. have query instances of class dao.queryraw()
, because select
complicated built simple querybuilder
(see other question). how query , build objects rawrowmapper
:
genericrawresults<string[]> rawresults = getcarddao().queryraw(statement); list<card> results = new arraylist<card>(); (string[] row : rawresults) { results.add(getcarddao().getrawrowmapper().maprow(rawresults.getcolumnnames(), row)); } rawresults.close();
unfortunately when try foreigncollection
on objects, returns null. if query objects simple dao.queryforfirst
, foreigncollection
ok.
i have had same problem today. solution has been call
dao.refresh(<card object>)
for every object returned queryraw function (and accumulated "results" list). trick me, reloading objects db filled foreign collection.
Comments
Post a Comment