-->
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.  [ 8 posts ] 
Author Message
 Post subject: Select ...
PostPosted: Mon May 24, 2004 11:48 am 
Newbie

Joined: Mon Apr 05, 2004 10:40 am
Posts: 19
i want to select some attributes of a object

i wrote my code
select obj.attrb1,obj.attrb2 from MyObject as obj

i have the result as a list from query.list().

QUESTION?how to access to the different attriibutes..
thanks for the help


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 24, 2004 11:51 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
you get a list of Objet[]

Object[0] give you first asked property
Object[1] give you second asked property...
you just have to cast it on the type you need

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject: select....
PostPosted: Mon May 24, 2004 11:57 am 
Newbie

Joined: Mon Apr 05, 2004 10:40 am
Posts: 19
the query.list() return a list of objetct.

i did Object myobj = query.lis();

the when i did myobj[0] it didnt work beacause is note an array


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 24, 2004 11:58 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Object[] myobj = (Object[]) query.lis();

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 24, 2004 12:01 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Object[] myobj = (Object[]) query.list().get(0); of course.... you'll need an iterator...

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject: select...
PostPosted: Mon May 24, 2004 12:03 pm 
Newbie

Joined: Mon Apr 05, 2004 10:40 am
Posts: 19
thanks it work fine.
i want to ask if u have already select an objetc that contain 2 or + attribute (Set ie:another object)


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 24, 2004 12:24 pm 
Newbie

Joined: Mon Apr 05, 2004 10:40 am
Posts: 19
i want to clarify my question

i have MyObject

{
....

Set attr;
Set attr;

}

when i did "from MyObject" i didnt work??

thanks for your helps


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 24, 2004 2:28 pm 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
Quote:
when i did "from MyObject" i didnt work??


it's not the first time you ask something like this, how can you imagine we might help you with such a poor demand?

please give the stacktrace and mapping file
are you sure hibernate succeed in reading mapping file?

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.