Affects Version/s: 4.3.0.Final, 4.4.0.Final, 4.5.0.Alpha1
Fix Version/s: 5.0.0.Alpha5
Bug Testcase Reminder (view):
(We are working on a test case.)
From my post on the list:
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.