-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: ResultTransformer
PostPosted: Thu Apr 16, 2009 8:07 am 
Newbie

Joined: Wed Jan 17, 2007 9:39 pm
Posts: 5
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.