Hi,
Can anbody point me to an example or tell me how to handle collections in non entity managed beans in a native sql statement?
Using the following as rough pseudo code.
Code:
sess.createSQLQuery("SELECT p.name as personName, c.name as catName, k.name as kittenName
FROM people p, cats c, kittens k
where p.id = c.id and c.id = k.id
and p.name like '%Tom%")
.setResultTransformer(Transformers.aliasToBean(PersonDTO.class)).list();
public class PersonDTO {
private String personName;
private List<Cat> cats;
}
public class CatDTO {
private int catName;
private List<KittenDTO> kittens;
}
public class KittenDTO {
private String Name;
}
Thanks.