-->
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.  [ 3 posts ] 
Author Message
 Post subject: Reindexing embedded Collection FieldBridge : Lazy Exception
PostPosted: Tue Dec 20, 2011 1:10 pm 
Newbie

Joined: Tue Dec 20, 2011 6:54 am
Posts: 4
We notice systematic Lazy Exception mass-indexation problem on embedded collection fieldbridge.
Here are the relations used :

Subscription (n) -> (1) @IndexEmbedded User (n) -> (n) @Field(...fieldBridge...) UserGroups
* user is an @IndexEmbedded field in Subscription object.
* userGroups is a Collection BridgeField (object to id) in User object.

So Subscription has a user.userGroups field which must store all the userGroups of the linked user. This field systematically throws a LazyInitializationException at reindex time.

After some investigation, I found out that only first level fields (for example user subscription) are connected to session. All the second level collection bags are not connected and throws a LazyInitializationException if we try to index them.
It appears that EntityConsumerLuceneWorkProducer relies on a side-effect for initializing lazy collection. At EntityConsumerLuceneWorkProducer.java:131 (Hibernate Search 4.0), session.buildLockRequest( LockOptions.NONE ).lock( take ); links only first level collection bags with session.

Then, in DocumentBuilderIndexedEntity:491, all fields (first or more level) are fetched without initialization, so it fails for second (or more) level lazy fields.
As objectInitializer is available in this method, it seems that it should inialize all lazy fields, without relying on lock side-effect.

Should I open a ticket on JIRA ? What is the best way to address this problem ?


Thanks


Top
 Profile  
 
 Post subject: Re: Reindexing embedded Collection FieldBridge : Lazy Exception
PostPosted: Tue Dec 20, 2011 1:34 pm 
Newbie

Joined: Tue Dec 20, 2011 6:54 am
Posts: 4
I try to add a @Cascade(CascadeType.LOCK) on "user" field in Subscription object. This enables me to end correctly reindex without any lazy exception.

So correct object initialization relies effectively on Lock event. But I am not sure that indexation should rely on this.


Top
 Profile  
 
 Post subject: Re: Reindexing embedded Collection FieldBridge : Lazy Exception
PostPosted: Sat Feb 11, 2012 2:11 pm 
Newbie

Joined: Tue Dec 20, 2011 6:54 am
Posts: 4
If anyone is interested, I create an issue on Jira : https://hibernate.onjira.com/browse/HSEARCH-1030


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

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.