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

x
?
Solved

Hibernate fetch layer configuration

Posted on 2009-07-09
3
Medium Priority
?
319 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

650 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