]
Sanne Grinovero commented on HSEARCH-704:
-----------------------------------------
this is lingering since march; is there some code, or shall we move it to 4.1 ?
Loading objects leads to 1+n queries when JPA's @Id !=
@DocumentId property
---------------------------------------------------------------------------
Key: HSEARCH-704
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-704
Project: Hibernate Search
Issue Type: Improvement
Components: query
Reporter: Emmanuel Bernard
Assignee: Hardy Ferentschik
Fix For: 4.0.0.Final
Today we load the objects once using a Criteria query.
And to return the object by relevance, we call
ObjectLoaderHelper.returnAlreadyLoadedObjectsInCorrectOrder
which in the @DocumentId != @Id case, runs one criteria query per object again.
That leads to 1+n queries which is not acceptable.
To work around that we could (only in the @DocumentId != @Id) case:
- run the first criteria query so that it returns a List of tuples { documentIdProperty,
entity }
- keep this List around
- when loading entities ber relevant order, use this list to fetch the data from memory
instead of this additional n Criteria queries)
--
This message is automatically generated by JIRA.
For more information on JIRA, see: