-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: OneToOne Lazy Load
PostPosted: Tue Dec 18, 2007 3:39 pm 
Newbie

Joined: Tue Dec 18, 2007 3:34 pm
Posts: 1
I have 2 classes, Body and Heart and I could not lazily load the Heart class. Here is my code

I am using Hibernate 3.2

-----------
package test;


import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.Proxy;

import javax.persistence.*;

@Entity
public class Body {
@Id
@GeneratedValue
int id;
int name;

@OneToOne(optional = false, fetch=FetchType.LAZY)
@JoinColumn(name="HID")
Heart heart2;
}

--------------------
package test;
import javax.persistence.*;

@Entity
public class Heart {
@Id
@GeneratedValue
int id1;
int valves;

@OneToOne (mappedBy="heart2", optional = false, fetch=FetchType.LAZY)
Body b;
}


When I try to load the Heart object, Body object is getting loaded as well?
Is there anything I have to do to make it lazy load?

Is it because heart is not the owning side of the association?


But when I load the Body object, Heart object is NOT getting loaded.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.