Solved

Hibernate fetch layer configuration

Posted on 2009-07-09
3
317 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 500 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 500 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

689 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