-->
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: How many items should hibernate return in case of join
PostPosted: Wed Mar 09, 2005 5:39 am 
Newbie

Joined: Wed Mar 09, 2005 5:03 am
Posts: 7
Hibernate version:2.1.8
Hibernate dialect:net.sf.hibernate.dialect.Oracle9Dialect

The problem description:

I have 2 tables in my database: server, server_attribute;
I am trying to get all server objects with their attributes:
loadAll(Server.class);
SQL:
select this.SERVER_ID as SERVER_ID1_, this.URL as URL1_, this.CREATE_DT as CREATE_DT1_, this.MOD_DT as MOD_DT1_, attributes1_.SERVER_ID as SERVER_ID__, attributes1_.NAME as NAME__, attributes1_.SERVER_ID as SERVER_ID0_, attributes1_.NAME as NAME0_, attributes1_.VALUE as VALUE0_, attributes1_.CREATE_DT as CREATE_DT0_, attributes1_.MOD_DT as MOD_DT0_ from SERVER this left outer join SERVER_ATTRIBUTE attributes1_ on this.SERVER_ID=attributes1_.SERVER_ID where 1=1

The returned list size equals to server*server_attribute records count value (for example: 2 records in server table, 4 records in server_attribute
table; list size = 8).

Is it a default Hibernate functionality?
I expect the size to be equals to server table records count. Do i miss something here?

PS. i have the same problem with pagination:
setFirstResult();setMaxResults(); work fine only in case joins are not used.

Thanks in advance,
Jacob


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 09, 2005 6:41 am 
Newbie

Joined: Wed Mar 09, 2005 5:03 am
Posts: 7
Hibernate in action, page 262: If you fetch a collection, Hibernate does not return a distinct list. I guess this is the answear to my question.

Can someone from hibernate team comment it? Every persistent object
implements equals and hashCode methods. Why hibernate doesn't want to return a distinct list?


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.