[hibernate-dev] Mass indexer and lazy initialization exceptions S03E04

Guillaume Smet guillaume.smet at gmail.com
Wed Jan 8 04:29:18 EST 2014


Hi all,

It's been quite a long time since I came up with lazy initialization
problems in the mass indexer for the last time.

Unfortunately, this time, I don't see exactly how to fix this one and
I would like to ask for your advice about it.

The problem is quite simple:

I want to index the result of a method which invokes proxies along the
way. Something like:
@Field
public String getInformationWithProxy() {
     return getField().getFieldWhichIsProxyfied().getValue();
}

As the fieldWhichIsProxyfied is not unproxyfied by an
objectInitializer, it doesn't have any session attached thus the lazy
initialization exception.

Note that the method is of course more complex than that and it mixes
fields from different fields and levels so we cannot use
@IndexedEmbedded.

As we use it to sort the results, we cannot put the information in
different fields either.

All in all, we're kinda stuck with this one.

Any bright idea out there?

Thanks.

-- 
Guillaume


More information about the hibernate-dev mailing list