From: <leg...@at...> - 2003-06-26 13:20:54
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-160 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-160 Summary: Batch Reading Type: New Feature Status: Unassigned Priority: Minor Project: Hibernate2 Components: core Versions: 2.0.1 Assignee: Reporter: Mike Gorman Created: Thu, 26 Jun 2003 8:19 AM Updated: Thu, 26 Jun 2003 8:19 AM Description: Feature is used to reduce # queries sent to the database to retrieve related lazily initialized 1-1's. Example: Retrieve 20 Contact objects, each has a 1-1 to an Account. Initial Query just asked to retrieve the Contact objects with nothing else being built initially. If each Contact works for a different Account, then if I call getAccount on each Contact (with initially empty cache), what started as 1 query turns into 21 queries (one PK query for each Account). Feature supports the ability for those lazy Account references to "remember" what their "originating query" was - the one used to retrieve the 20 Contact objects in the first place. Then, when the first Contact's "account" reference is initialized, it joins with the originating query's criteria to get all of the related accounts that match the originating query's criteria, populating the cache with 20 Account objects with one query. Now, what would otherwise be 21 queries is now just 2 (1 for the 20 Contacts, and 1 for the 20 Accounts). Example: originating query: select * from contact where last_name = 'Smith' Then, when the first uninitialized Contact.account reference is initialized (from that set of Contacts), the account query is: select t0.* from account t0, contact t1 where t1.account_id = t0.account_id and t1.last_name = 'Smith' --------------------------------------------------------------------- JIRA INFORMATION: 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 If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |