[ 
https://issues.apache.org/jira/browse/CAY-2412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nikita Timofeev updated CAY-2412:
---------------------------------
    Priority: Minor  (was: Major)

> SelectQuery with prefetches and cache bring data losing
> -------------------------------------------------------
>
>                 Key: CAY-2412
>                 URL: https://issues.apache.org/jira/browse/CAY-2412
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 4.0.B1
>         Environment: bootique 0.23
> bootique-jetty 0.23
> bootique-jcache 0.23
> bootique-cayenne 0.23
> cayenne-server 4.0.B1
>            Reporter: Artyom Kravchenko
>            Assignee: Nikita Timofeev
>            Priority: Minor
>
> SelectQuery with prefetches and cache bring data losing
> Object model looks like:
>  
> {code:java}
> COURSE OneToMany COURSE_CLASSES
> COURSE_CLASSES ManyToOne COLLEGE
> COURSE_CLASSES OneToMany SESSIONS
> COURSE_CLASSES ManyToOne ROOM
> ROOM ManyToOne SITE 
> {code}
>  
> Select query looks like:
> {code:java}
> List<Course> courses = ObjectSelect.query(Course.class)
> .where(Course.CODE.eq(code)) 
> .prefetch(Course.COURSE_CLASSES.joint()) 
> .prefetch(Course.COURSE_CLASSES.dot(CourseClass.COLLEGE).joint()) 
> .prefetch(Course.COURSE_CLASSES.dot(CourseClass.SESSIONS).joint())
> .prefetch(Course.COURSE_CLASSES.dot(CourseClass.ROOM).joint()) 
> .prefetch(Course.COURSE_CLASSES.dot(CourseClass.ROOM).dot(Room.SITE).joint()) 
> .cacheStrategy(LOCAL_CACHE) 
> .cacheGroup(Course.class.getSimpleName()) 
> .selectOne(context);
> {code}
>  where 
>  
> {code:java}
> context
> {code}
>  
> is shared readonly  instance of cayenne context. It is also used for other 
> queries inside our application.
>  
> When I iterate through result list 
> {code:java}
> courses.get(i).getCourseClasses(){code}
> I see that list of related CourseClasses is trimmed (doesn't contains full 
> set of records which expected, some records just lost).
> I am not sure who is blame on it
>  - is it prefetch semantic (I have found similar but not exact the same bug 
> CAY-2257)
>  - some concurrent modifications of related objects list (since we load it in 
> shared context)
>  - any caching  issues (we are using JCache/HECache implementation)
> In additional I can say that we are not limited number of cache entries for 
> any cache group, just use 10 min expiry timeout.
> But the main difficulties that I can not reproduce such behaviour locally 
> (reproducible on production environment only) so I can not write clear test 
> for this issue.
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to