-->
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.  [ 2 posts ] 
Author Message
 Post subject: Comment avoir accès aux différents champs d'un select ?
PostPosted: Wed Feb 08, 2006 7:42 am 
Newbie

Joined: Tue Jan 03, 2006 2:34 pm
Posts: 8
La réponse à ma question doit etre triviale, mais je ne suis pas arrivé à la trouver (j'ai pourtant regardé la doc, mais je dois pas chercher avec les bons mots clé je crois !)

Je fais une requete :

List maliste = session.createQuery(
"select timestamp, sum(valeur) from Releve where id=0 group by timestamp ")
.list();

j'obtiens bien une liste avec le bon nombre d'éléments, mais comment dois-je faire pour accèder à "maliste.get(0).timestamp" et "maliste.get(i).valeur" ?? Vers quoi je dois caster les objets contenus dans ma liste ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 08, 2006 8:03 am 
Newbie

Joined: Tue Jan 03, 2006 2:34 pm
Posts: 8
ok. Pour ceux qui se poseraient la meme question. voici un sample :

(http://www.hibernate.org/hib_docs/v3/re ... state.html)

Iterator kittensAndMothers = sess.createQuery(
"select kitten, mother from Cat kitten join kitten.mother mother")
.list()
.iterator();

while ( kittensAndMothers.hasNext() ) {
Object[] tuple = (Object[]) kittensAndMothers.next();
Cat kitten = tuple[0];
Cat mother = tuple[1];
....
}


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

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.