MassIndexer: @IndexEmbedded, lazy field and FieldBridge problem



This is a followup of fixed a while ago by one of my colleagues (Laurent Almeras).

We have the very same problem with the Mass Indexer in the following case:
Root Entity -> @IndexEmbedded -> Entity -> @ManyToOne(fetch = FetchType.LAZY) with @FieldBridge.

The main problem is that the object should be unproxied before the injection in the field bridge code in DocumentBuilderIndexedEntity.

Once you have done that, you need to override unproxy in HibernateSessionLoadingInitializer to inject a session in the initialization.

We have a pull request ready with a test case and a patch. We'll post it once we have the patch number.

I signed a personal contributor agreement a while ago but, as this work was done on my employer time by my colleague Stéphane Gleizes and me, I think we need to sign a corporate agreement.

Feel free to ping me on this subject.

By the way, this patch should be backpatched in 4.1.x if possible.




Guillaume Smet
October 6, 2012, 12:48 AM

Hi Sanne,

I just signed a corporate CLA for my contributions on my employer time. I'm going to be the JBoss contact to validate the corporate CLAs for Open Wide. Stéphane will do the same (I pinged him about it, not sure when he will be able to do so as he only works part time for us - I'll let you know when it's done).

I'll test your pull request tomorrow. It looks a lot like what I was looking for. Thanks for that. I'll pull it and let you know how it works here.

By the way, while helping Stéphane on the test case for this issue, I spotted a typo in the test Laurent added in HSEARCH-1030. I don't think a JIRA issue is necessary for this sort of thing, can I send a pull request directly or should I create a JIRA first?

Thanks for your feedback.

Sanne Grinovero
October 6, 2012, 7:05 PM

Nice! I'll merge this as soon as CLAs are signed and you tell me it works as needed.

Guillaume Smet
October 6, 2012, 9:00 PM

I confirm that it works as expected. I upgraded our application to 4.2.0-SNAPSHOT and put back the FetchType.LAZY: the mass indexer is working great.

I'll ping you when I have news from Stéphane about his CLA.

Guillaume Smet
October 8, 2012, 11:56 AM

Hi Sanne,

You should have received the CLA of Stéphane.


Sanne Grinovero
October 8, 2012, 12:00 PM

great, thanks.


Guillaume Smet


Guillaume Smet



Suitable for new contributors


Pull Request


Feedback Requested



Fix versions

Affects versions