-->
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.  [ 4 posts ] 
Author Message
 Post subject: Joins
PostPosted: Thu Dec 02, 2004 6:20 am 
Newbie

Joined: Fri Feb 06, 2004 10:16 am
Posts: 7
Hi,

I'm using Hibernate 2.1.6 and I have a problem with joins. I have a mapping where an entity "A" has:

- a one-to-one relationship with the entity "B"
- a one-to-one relationship with the entity "C"

When using the hql question "from A", to list all A entities, there is a lot of sql selects generated, I think it's two selects for every A entity. Obviously this is not good from a performance view so my question is if there is another way to write this query to retrieve the relations in just one single join which is easily done with a native sql query? I tried to use proxies setting the class attribute "lazy" to true for B and C but that doesn't help.

I have read the documents about join fetch but I can't get it to wrok. Can someone please help me here and provide me with an example?

Thanks in advance

/B


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 02, 2004 6:54 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
well ...i don't know why two threads ... but i know that i don't have all information i need to help you ...

gtx
curio


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 02, 2004 7:06 am 
Newbie

Joined: Fri Feb 06, 2004 10:16 am
Posts: 7
Sorry about the two threads but obviously this wasn't my intention, and it wasn't possible to delete one of the threads. What other type information do you need to be able to help me?

/B


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 03, 2004 4:32 am 
Expert
Expert

Joined: Tue Oct 05, 2004 9:45 am
Posts: 263
sorry for my late response ...

well .. what do i need? Mappings, debug-log where one can see the generated sql, source-code ... everything what is mentioned when you're starting a thread.

My join-operations work (i think) perfectly ... so i would think that there's perhaps something wrong in the mapping ...

Good examples about one-to-one relations can be found in HiA and (i think) in caveatEmptor ...

gtx
curio


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