Solved

why  fetch join in hibernate

Posted on 2009-05-11
2
523 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
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
HashTable highest marks enumeration alternative 9 37
Eclipse with gitlab 1 37
Which non-HTML GUI front end to use with Java? 3 20
Java: anonymous class 4 17
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

808 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