ForeignCollection auto load with queryRaw()
I have a Card class, which has an eager ForeignCollection in it. I have to
query for the instances of this class with a Dao.queryRaw(), because my
SELECT is too complicated to be built with a simple QueryBuilder (see my
other question). This is how i query and build my objects with
RawRowMapper:
GenericRawResults<String[]> rawResults = getCardDao().queryRaw(statement);
List<Card> results = new ArrayList<Card>();
for (String[] row : rawResults) {
results.add(getCardDao().getRawRowMapper().mapRow(rawResults.getColumnNames(),
row));
}
rawResults.close();
Unfortunately when i try to get the ForeignCollection on my objects, it
returns null. If i query the objects with a simple Dao.queryForFirst, the
ForeignCollection is OK.
No comments:
Post a Comment