]
Emmanuel Bernard commented on HSEARCH-704:
------------------------------------------
Hardy, do you think you can fix this for 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
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: