[hibernate-dev] [SEARCH] Result ignored if proxy isn't initialized

Sanne Grinovero sanne at hibernate.org
Mon Nov 4 17:21:10 EST 2013


Hi Guillaume,
very interesting analysis.
Definitely needs further inspection, could you please open a JIRA?

Would you be able to verify the same problem with the simple HashMap
second level cache?
I'm wondering if I would be able to reproduce the case without adding
Ehcache to our test dependencies.

BTW I don't think there is any change in Hibernate Search 4.4.0.Final
in the loaders area, but I would expect you to try the update ;-)

Cheers,
Sanne

On 4 November 2013 18:26, Guillaume Smet <guillaume.smet at gmail.com> wrote:
> Hi,
>
> We have a weird problem here with Search 4.3 and ORM 4.2.7.SP1. I
> wonder if it rings a bell for anyone?
>
> In yet to determined circumstances, an object is missing from the
> search results.
>
> This object is returned by the Lucene search but is not added in the
> results because it isn't initialized.
>
> In ObjectLoaderHelper.returnAlreadyLoadedObjectsInCorrectOrder(),
> there is a test to check if the element is initialized before
> including it in the results list.
>
> The fact is that sometimes, the element is a Javassist proxy (we use
> ehcache) and isn't initialized at all even if it exists in the
> database. Thus it's not included in the results.
>
> A few more comments:
> - if we force the initialization with the IDE by inspecting the object
> before the test, the element is included and everything works fine;
> - if we use the SecondLevelCacheObjectsInitializer (by calling
> fullTextQuery.initializeObjectsWith(ObjectLookupMethod.SECOND_LEVEL_CACHE,
> DatabaseRetrievalMethod.QUERY);) instead of the Criteria one,
> everything works fine too.
>
> I'm wondering if this test is legit and if the assertion that the
> object should be initialized here or doesn't exist in the database is
> really true, especially when the object is cached and is a Javassist
> proxy.
>
> We have a workaround but I'm pretty sure there's a bug somewhere.
>
> cc: Yoann which is working on the project where we met this bug today.
>
> Thanks for your feedback.
>
> --
> 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