Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

why  fetch join in hibernate

Posted on 2009-05-11
2
Medium Priority
?
534 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 500 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

610 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