Message:
A new issue has been created in JIRA.
---------------------------------------------------------------------
View the issue:
http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-296
Here is an overview of the issue:
---------------------------------------------------------------------
Key: CAY-296
Summary: Fix issues of mixing joint and regular prefetches
Type: Improvement
Status: Assigned
Priority: Minor
Project: Cayenne
Components:
Cayenne Core Library
Fix Fors:
1.2 [DEV]
Versions:
1.2 [DEV]
Assignee: Andrus Adamchik
Reporter: Andrus Adamchik
Created: Sat, 19 Mar 2005 11:03 PM
Updated: Sat, 19 Mar 2005 11:03 PM
Description:
A single query can mix regular and joint prefetches. This works when prefetches do not depend on each other or "shorter" prefetch is joint (e.g. "paintingArray" is joint, "paintingArray.toPaintingInfo" is reglar).
The reverse order causes problems - see test case below (should be inserted to DataContextPrefetchMultistepTst.java).
Currently joint prefetches are resolved first, and regular - after that. So if a "shorter" path is a regular prefetch, it doesn't work.
A solution will probably merge two resolver trees in a single one...
public void testMixedPrefetch2() {
Expression e = Expression.fromString("galleryName = $name");
SelectQuery q = new SelectQuery(Gallery.class, e.expWithParameters(Collections
.singletonMap("name", "gallery2")));
// reverse the order of prefetches compared to the previous test
q.addPrefetch("exhibitArray");
q.addJointPrefetch("exhibitArray.artistExhibitArray");
List galleries = context.performQuery(q);
assertEquals(1, galleries.size());
Gallery g2 = (Gallery) galleries.get(0);
// this relationship should be resolved
assertTrue(g2.readPropertyDirectly("exhibitArray") instanceof ToManyList);
ToManyList exhibits = (ToManyList) g2.readPropertyDirectly("exhibitArray");
assertFalse(exhibits.needsFetch());
assertEquals(1, exhibits.size());
Exhibit e1 = (Exhibit) exhibits.get(0);
assertEquals(PersistenceState.COMMITTED, e1.getPersistenceState());
// this to-many must also be resolved
assertTrue(e1.readPropertyDirectly("artistExhibitArray") instanceof ToManyList);
ToManyList aexhibits = (ToManyList) e1.readPropertyDirectly("artistExhibitArray");
assertFalse(aexhibits.needsFetch());
assertEquals(1, exhibits.size());
ArtistExhibit ae1 = (ArtistExhibit) aexhibits.get(0);
assertEquals(PersistenceState.COMMITTED, ae1.getPersistenceState());
}
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://objectstyle.org/jira/secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
This archive was generated by hypermail 2.0.0 : Sat Mar 19 2005 - 23:05:22 EST