BatchFetchQueue.getXXXBatch() cache check impeding batch fetching
-----------------------------------------------------------------
Key: HHH-2223
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2223
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.2.0.ga
Environment: 3.2.0GA, Mac OS X/Solaris 10, Sybase 12.5/HSQLDB
Reporter: Joel Caplin
Priority: Minor
Attachments: testcase.tar
I have attached a test case which demonstrates the issue at hand by implementing a cheap
data model: Pub >---|- Manager -|--< Employee
Pub and Employee are uncached; Manager is cached (tried under both Eh and the non-prod
HashMap implementation). All associations are lazy. The test case has a default batch size
of 10 and uses hsqldb to demonstrate the problem - which was diagnosed against Sybase.
When BatchFetchQueue.getXXXBatch() is invoked, it does not load any objects it finds in
the second level cache - it merely acknowledges their presence by logging to INFO
(isCached()). This in turn means that any child associations in that cached object will
not have a proxy created for them.
Suppose we want to find all the employees of the pubs in our database. We choose to do
this by loading all the Pubs ("FROM Pub") and calling
thePub.getManager().getEmployees() iteratively.
When the managers are in the second level cache, Hibernate issues 11 select statements:
one to load the pubs and one for each distinct manager.
When the Managers are not in the cache, Hibernate issues 3 select statements: one to load
the pubs, one to load the managers and one to load the employees.
A solution might be to load the object from the cache instead of just ignoring it?
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira