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.
|