-->
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: Lazy 1-to-0-or-1 relationships (ejb.use_class_enhancer)
PostPosted: Tue Sep 16, 2014 11:07 am 
Newbie

Joined: Tue Sep 16, 2014 11:05 am
Posts: 1
Hello,

As you know, lazy loading of inverse (not owning) optional one-to-one relationships using Hibernate does not work out of the box.
Hibernate does not know if a proxy object or NULL must be used, so the loading occurs before the field is accessed for the first time (NOT LAZY).

There are some solutions for this problem (also known as shared PK one-to-zero-or-one), and I need to use the one that involves runtime bytecode instrumentation. It requires Hibernate as JPA provider in full-blown JEE environment (I am using JBoss 7.1.1), setting "hibernate.ejb.use_class_enhancer" to true.

So, following Table 2.1 in
http://docs.jboss.org/hibernate/stable/entitymanager/reference/en/html/configuration.html
I added the following line to persistence.xml:
<property name="hibernate.ejb.use_class_enhancer" value="true" />

The application works fine (no errors), BUT nothing changes (Hibernate still runs thousands of queries). My goal is to load the optional onetoone relationship only when the value is needed, because the eager loading is giving me performance issues.

Does anyone have any ideas?


Thank you,
S.


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.