Solved

why  fetch join in hibernate

Posted on 2009-05-11
2
529 Views
Last Modified: 2013-11-24
please see this hibernate tutorial. i have question here

http://72.14.235.132/search?q=cache:Va2qJokS5gwJ:www.metaarchit.com/hibernate_tutorials/Hibernate%2520Tutorial%252004.pdf+Hibernate+Association&cd=9&hl=en&ct=clnk&gl=in&client=firefox-a


see this code given in that tutorial  under   "1.2 Fetching strategies"

<hibernate-mapping package="com.metaarchit.bookshop">
<class name="Book" table="BOOK">
...
<many-to-one name="publisher" class="Publisher" column="PUBLISHER_ID"
lazy="false" fetch="join" />
</class>
</hibernate-mapping>


My Question is , why do we use fetch="join"  in the above ?  if we just  have lazy="false"  then book and chapters both will be loaded .....so why  extra fetch="join"  again ?   i think we can skip fetch="join"  .....i am not clear at this part.
0
Comment
Question by:cofactor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 125 total points
ID: 24360679
you would do that to avoid the second select, and select the related publisher using a join


0
 

Author Comment

by:cofactor
ID: 24360809
Ahh...so   this is just a performance issue here ...earlier two select query fired ...now single select query will be fired because of this "join"  thingie  ...good to know ...thanks


thanks


0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question