-->
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: question on query.list() ?
PostPosted: Tue Mar 15, 2005 5:39 am 
Newbie

Joined: Mon Jan 31, 2005 11:33 am
Posts: 8
Location: Netherlands
Hi Guys,
I have a strange problem, when I execute the code mentioned below the list contains repeated entires of first record only ... I tried using session.find() func to fetch all records which resulted in different records but large number of them still repeat...

query = session.createQuery("from XDataTO where stype = :var order by sleutel");
query.setString("var", "FUNC");
List list = query.list();

I am using RAD6.0 with DataSource accessed via JNDI (hibernate.cfg.xml)

I have exhausted various ways which hibernate provides to fetch data but everyone results in duplex objects..

Can anyone please issolate this issue for me or atleast point me in the right direction ?

Cheers
Andy


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 15, 2005 8:07 am 
Newbie

Joined: Mon Jan 31, 2005 11:33 am
Posts: 8
Location: Netherlands
I was able to solve the issue it was a DataBase issue being legacy system they had multiple constraints on sevral columns to make them unique.

Therefore by using composite-id tag inside hbm.xml and over ridding equals + hashCode methods (for bean).. I am now able to direct hibernate to recognize a unique combination of columns..

If the "id" inside hbm.xml is not unique hibernate duplicates all records with similar id's and that was what I was getting as result..

Have a nice day guys...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 15, 2005 8:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
yes - id is something that has to be unique, otherwise it aint an id is it ? ;)

_________________
Max
Don't forget to rate


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.