?
Solved

Hibernate fetch layer configuration

Posted on 2009-07-09
3
Medium Priority
?
318 Views
Last Modified: 2012-06-22
HI: In hibernate, If I have a class A which has one to one mapping (bi direction) to Class B. And Class B has one to one mapping (bi direction) to Class C. And Class C has bidirection to Class D ...

Now when I fetch Class A's object. Hibernate will fetch its assocation with Class B. And Class B will fetch its association Class C. ....

My question is to tune this layer parameter. So when I load Class A's object, I donot need Class C object is also loaded. Where is hibnerate configuration file for it?  
0
Comment
Question by:JianJunShen
[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
3 Comments
 
LVL 17

Assisted Solution

by:Dejan Pažin
Dejan Pažin earned 2000 total points
ID: 24813123

You have to set lazy loading on those properties. If you are using annotations (I recommend it), this is what you do:


@OneToOne(fetch = FetchType.LAZY)

or

@ManyToOne(fetch = FetchType.LAZY)

0
 
LVL 17

Accepted Solution

by:
Dejan Pažin earned 2000 total points
ID: 24813208
0
 
LVL 40

Expert Comment

by:mrjoltcola
ID: 24813469
Also google: hibernate proxy object

for some good reading. A proxy is what is created to represent classes in lazy loading, so you should understand them.
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

743 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