-->
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.  [ 3 posts ] 
Author Message
 Post subject: Wrong results from Query object
PostPosted: Fri Mar 19, 2004 3:24 pm 
Beginner
Beginner

Joined: Mon Mar 08, 2004 5:22 pm
Posts: 35
String findAuctionInfo =
"from Person as person where person.AUCTID = :auctionId";

Query query = sess.createQuery(findAuctionInfo);
query.setString("auctionId", auctionId);// some id
List list = query.list(); // I checked this line in debug mode.


I have 500 people in database for this id with FNAME and LNAME.
But my list has all 500 Person objects with "Dorothy", "Advins".

This is the first record.
FNAME = "Dorothy" LNAME = "Advins"


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 19, 2004 4:21 pm 
Beginner
Beginner

Joined: Mon Mar 08, 2004 5:22 pm
Posts: 35
I ran the same query SQL tools which returns different names, but in the LIST [returned by Query Interface] has the same record many times.


Here is the generated query :
select prtdirview0_.AUCTID as AUCTID, prtdirview0_.FAX as FAX,
prtdirview0_.PHONE as PHONE, prtdirview0_.PSEMLADDR as PSEMLADDR,
prtdirview0_.PSDEPTDESC as PSDEPTDESC, prtdirview0_.PRTFNAME as PRTFNAME,
prtdirview0_.PRTLNAME as PRTLNAME, prtdirview0_.PRTFLAG as PRTFLAG,
prtdirview0_.PRTEMPST as PRTEMPST
from PRTDIRVIEW prtdirview0_ where prtdirview0_.AUCTID='AAA'


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 19, 2004 8:34 pm 
Beginner
Beginner

Joined: Wed Mar 17, 2004 4:13 pm
Posts: 21
Location: San Diego, CA
Post the code where you get the results from the list.

Are you sure you are iterating the list correctly? Post the code so we can view it. Perhaps you are getting the size of the list (500), then getting the first object from the list 500 times.

We all make silly mistakes now and again.

Chrisjan


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