OK, I'm really lazy like you.
I did get the setResultTransformer to work, but I still have one issue with it.
This is the code that I'm using
Code:
String query =
"select tbl1.my_flag1 as myFlag1, " +
" tbl1.my_flag2 as myFlag2" +
"from tbl1 where tbl1.id = :id";
org.hibernate.Query q = ((Session)em.getDelegate()).createSQLQuery(query)
.addScalar("myFlag1",Hibernate.STRING)
.addScalar("myFlag2",Hibernate.STRING)
.setResultTransformer(Transformers.aliasToBean(MyClass.class));
q.setParameter("id", 1);
q.list();
This doesn't work - it gives me a "column not found". It seems that it is returning the column name as all lowercase (using informix db). I would have assumed the alias' would have changed what the db names brought back.
If I change the following lines to "addScalar("myflag1")" / "addScalar("myflag2"), then it gives an error on my class saying it can't find a setter for the columns (the setters are setMyFlag1,setMyFlag2).
Is there an easy way to modify the column names brought back???
thanks!