-->
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: Selecting some columns into a hash
PostPosted: Fri Aug 24, 2007 8:30 am 
Newbie

Joined: Fri Aug 17, 2007 10:06 am
Posts: 11
Hi, how can I get the results of a query and insert in a hash or list or any other list object

example:

Query q = Sistema.getSession().createQuery("select distinct new Guia(g.guia, b.nome) from Guia g, Beneficiario b, GuiaEvento e where g=e.guia and e.dataexecucao between :di and :df and b=g.beneficiario and b.empresa=:empresa");
q.setEntity("empresa", this);
q.setDate("di", dataInicial);
q.setDate("df", dataFinal);
return q.list();

My Guia object does not have a constructor with these two parameters. Instead of creating a constructor for every different select, I think to get this result in a generic class.


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.