Is it possible to get OneToOne relationships to be lazy initialized?
Our "main" entity has 12 or so OneToOne relationships that seem to get selected every time.
We're doing a simbol "from MainClass" query on the entity manager, but when I enable hibernate sql tracing, i see all the related tables get included.
I've tried turning on "hibernate.bytecode.use_reflection_optimizer=true"
just in case that was it. Also tried "hibernate.ejb.use_class_enhancer" in persistence.xml, but got class not found exceptions looking for ASM
We use on our Main class:
@OneToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.MERGE}) @PrimaryKeyJoinColumn private ChildObject child;
public ChildObject getChild(){ return child; } public void getChild(ChildObject child){ this.child = child; }
Sorry to be bumping my post here, but I am really curious if this is even supposed to work.
We can't seem to figure out a way to select the parent without also selecting the children. Which works fine until the tables get really big.