s.CreateQuery(hql) .SetResultTransforemer(Transformers.AliasToBean(typeof(DTO)) .List<DTO>();
On Fri, Sep 12, 2008 at 4:35 AM, crabo <[EMAIL PROTECTED]> wrote: > > I really like the following query expression, but I have no success > with my NUnit test. > > > check out : http://blog.hibernate.org/2133.lace > > Hibernate 3.2: Transformers for HQL and SQL > > HQL Transformers > Now you can get the value injected via property methods or fields > instead, removing the need for explicit constructors. > > List resultWithAliasedBean = s.createQuery( > "select e.student.name as studentName," + > " e.course.description as courseDescription" + > "from Enrolment as e") > .setResultTransformer( Transformers.aliasToBean(StudentDTO.class)) > .list(); > > StudentDTO dto = (StudentDTO) resultWithAliasedBean.get(0); > > > > -- Ken Egozi. http://www.kenegozi.com/blog http://www.musicglue.com http://www.castleproject.org http://www.gotfriends.co.il --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
