-->
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: Strange Behavior...
PostPosted: Mon May 02, 2005 1:36 am 
Newbie

Joined: Mon May 02, 2005 12:56 am
Posts: 17
I have the following code.

List results = session.createCriteria(MyClass.class)
.add(Restrictions.eq("ATTR_ID",attrID))
.addOrder(Order.desc("CODE_LONG_DESC"))
.list();

The size of the results list is 5.

But all the 5 rows are having the same data.
Any idea what is happening?

Thanks in advance.
Shrimon.


Top
 Profile  
 
 Post subject: Re: Strange Behavior...
PostPosted: Mon May 02, 2005 4:47 pm 
Expert
Expert

Joined: Mon Feb 14, 2005 12:32 pm
Posts: 609
Location: Atlanta, GA - USA
shrimon wrote:
I have the following code.

List results = session.createCriteria(MyClass.class)
.add(Restrictions.eq("ATTR_ID",attrID))
.addOrder(Order.desc("CODE_LONG_DESC"))
.list();

The size of the results list is 5.

But all the 5 rows are having the same data.
Any idea what is happening?

Thanks in advance.
Shrimon.


This can happen if there is a join in your mapping. You can create a new Set() using the results which will limit to only one object.
(Also, why the Hibernate guys always request that you include your mapping files in your post) ;-)


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.