[hibernate-issues] [Hibernate-JIRA] Created: (HSEARCH-704) Loading objects leads to 1+n queries when JPA's @Id != @DocumentId property
Emmanuel Bernard (JIRA)
noreply at atlassian.com
Fri Mar 4 05:31:08 EST 2011
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
Fix For: 3.4.0
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.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list