Hi,
I'm trying to use ResultTransformer, but I can't get it to work properly. I wanna populate an Entity and a Calendar object in another class that I created (but its not an entity)
Here's the code:
Code:
StringBuilder sql = new StringBuilder();
sql.append("SELECT DISTINCT {funcionario.*}, r.registro_time as dateRegistro FROM users funcionario JOIN registro r on r.funcionario_id=funcionario.funcionario_id ");
SQLQuery query = getSession().createSQLQuery(sql.toString());
query.addEntity("funcionario", User.class);
query.setResultTransformer(Transformers.aliasToBean(MinhaClasse.class));
Code:
public class MinhaClasse{
private User funcionario;
private Calendar dateRegistro;
}
It populates the funcionario object correctly, but I always get dateRegistro object null. It never put the date from the database in that object.
Can you help to solve this problem? Am I using ResultTransformer wrong?
PS: I'm using Oracle 10g and sorry for my bad English (I'm still learning :P)
Thanks