]
Gail Badner resolved HHH-2728.
------------------------------
Resolution: Fixed
Fixed trunk / 3.2.
Calling session.clear() while retrieving objects via an iterator will
cause a "LazyInitializationException - No Session" by the CGLIBLazyInitializer
----------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-2728
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2728
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.4.sp1
Environment: Any
Reporter: Metin Göktay
Assignee: Gail Badner
Priority: Minor
Fix For: 3.2.6, 3.3
Attachments: HHH-2728-testcase.patch
Given the following code
Iterator stagingIterator = query.iterate("from "+entityName+"
where importSourceFile.id = ?", deliveryId); // large result set
while (stagingIterator.hasNext()) {
Importable staging = stagingIterator.next();
Approvable approvable = this.approve(staging);
tmp.add(approvable);
i++;
if (i % 200 == 0) {
LOG.debug("Flushing+Clearing after "+i+"
entries.");
session.flush();
session.clear();
}
}
After clearing the session for the first time (resp. after the first 200 entries) the
CGLIBInitializer object of next returned HibernateProxy object does not have a session any
longer resulting in a "LazyInitializationException - No Session" exception.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: