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

Then just plain old:

  | public ChildObject getChild(){ return child; }
  | public void getChild(ChildObject child){ this.child = child; }
  | 

We have the same issue on objects where the persistence annotations are on the 
getChild() method.  I just recently moved them to the properties since it's 
much cleaner to have them all together at the top without the noise of the 
get/set methods between the fields.



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949243#3949243

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949243


_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to