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

Sanne Grinovero sanne at hibernate.org
Wed Jan 8 07:43:54 EST 2014


Hi Guillaume,
would you agree this looks like similar to HSEARCH-1260 ?

I'd like to step back a moment and re-evaluate how we faced all these
lazyinitialization issues.

As far as I remember, you and your team reported (and helped fixing!)
a depressingly long list of issues since approximately the migration
to Hibernate ORM 4 of your applications (adopting AFAIR early betas of
Search 4.2 at the time - thanks JIRA for the records).
So that data point means to me that you are in the sweet spot
intersection of the sets {people who reported issues} V {people who
actually use a non trivial Domain model}, and in the current era it
looks like we don't have many contributors matching your team on these
qualities.

In a previous era, when Hibernate Search was based on ORM 3.x, I was
working on a different project which had an extremely complex domain
model (about 400 Hibernate mapped entities, of which at least 50 where
@Indexed and with fairly advanced usage of custom types, custom
fieldbridges, Filters, etc...). I'm mentioning this nice domain model
I had, as I'm pretty sure that all these cases where working fine back
then :-)
I designed and implemented the MassIndexer back then, specifically
tailored for this complex domain, and it worked fine.
>From the looks of all these issues, I'm pretty sure that my own model
would have failed all the same tests you've described, and maybe even
more. Sadly, I don't have access to the staging DB of that application
anymore :-(

Why I'm sharing this data points?
The MassIndexer code didn't change significantly since when it worked
fine on my app, so I'm thinking now that we have been fixing the wrong
project. Would you agree that it looks like related to how ORM changed
some internal details of how proxies and lazy collections get
re-attached to ORM?

We probably should *remove* all the "reattaching proxies" logic
workarounds from the MassIndexer, let it fail hard and see if we can
get Hibernate ORM to behave like it did with Hibernate 3. That's
probably the better way of how we should have fixed these issues from
the beginning.

Hope I'm making sense ? It would also be great for use cases like HSEARCH-1260.

Sanne




On 8 January 2014 09:29, Guillaume Smet <guillaume.smet at gmail.com> wrote:
> 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
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev


More information about the hibernate-dev mailing list