cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Savva Kolbachev (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (CAY-1940) NullPointerException when try to Prefetch
Date Thu, 12 Mar 2015 12:55:38 GMT

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

Savva Kolbachev closed CAY-1940.
--------------------------------
       Resolution: Fixed
    Fix Version/s: 4.0.M3
         Assignee: Savva Kolbachev

> NullPointerException when try to Prefetch
> -----------------------------------------
>
>                 Key: CAY-1940
>                 URL: https://issues.apache.org/jira/browse/CAY-1940
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library, Database integration
>    Affects Versions: 3.2.M1
>         Environment: Ubuntu 14.04lts, Java 1.7, Mysql 5.5.37
>            Reporter: Andrey
>            Assignee: Savva Kolbachev
>             Fix For: 4.0.M3
>
>
> Use case description:
> Cayenne model:
> Tables:
> 	Contact
> 		id -primary key
> 		name - string
> 	Course
> 		id - primary key 
> 		name - string 
> 	Relation
> 		id - primary key
> 		entityIdentifier - entity name of related object
> 		entityId - id of related object
> 		ruleId - id of rule	
> 	Rule
> 		id - primary key
> 		name - string
> Classes:
> 	Contact
> 		properties: id, name
> 		relations: List< ContactRuleRelation> ruleRelations
> 	Course
> 		properties: id, name
> 		relations: List< CourseRuleRelation > ruleRelations
> 	RuleRelation		
> 		properties: id, entityIdentifier 
> 		relations: rule
>  
> 	ContactRuleRelation extends  RuleRelation
> 		(entityIdentifier = 'Contact')
> 	CourseRuleRelation extends  RuleRelation
> 		(entityIdentifier = 'Course')
> 	Rule
> 		properties: id, name	
> Data in the database:
> 	Contact:  id=1, name=Contact1
> 	Course: id=1, name=Course1
> 	Relation: id=1, objectIdentifier=Course, objectID=1, ruleId=1
> 	Rule: id=1, name=Rule1	
> SelectQuery:
> 	select Contact by id = 1 and add prefetch relations.rule
> As result the exception:
> java.lang.NullPointerException
>     at org.apache.cayenne.access.ResultScanParentAttachmentStrategy.indexParents(ResultScanParentAttachmentStrategy.java:104)
>     at org.apache.cayenne.access.ResultScanParentAttachmentStrategy.linkToParent(ResultScanParentAttachmentStrategy.java:72)
>     at org.apache.cayenne.access.HierarchicalObjectResolverNode.objectsFromDataRows(HierarchicalObjectResolverNode.java:70)
>     at org.apache.cayenne.access.HierarchicalObjectResolver$DisjointProcessor.startDisjointPrefetch(HierarchicalObjectResolver.java:121)
>     at org.apache.cayenne.query.PrefetchTreeNode.traverse(PrefetchTreeNode.java:206)
>     at org.apache.cayenne.query.PrefetchTreeNode.traverse(PrefetchTreeNode.java:221)
>     at org.apache.cayenne.query.PrefetchTreeNode.traverse(PrefetchTreeNode.java:221)
>     at org.apache.cayenne.access.HierarchicalObjectResolver.resolveObjectTree(HierarchicalObjectResolver.java:96)
>     at org.apache.cayenne.access.HierarchicalObjectResolver.synchronizedRootResultNodeFromDataRows(HierarchicalObjectResolver.java:78)
>     at org.apache.cayenne.access.DataDomainQueryAction$ObjectConversionStrategy.toResultsTree(DataDomainQueryAction.java:565)
>     at org.apache.cayenne.access.DataDomainQueryAction$SingleObjectConversionStrategy.convert(DataDomainQueryAction.java:603)
>     at org.apache.cayenne.access.DataDomainQueryAction.interceptObjectConversion(DataDomainQueryAction.java:459)
>     at org.apache.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:129)
>     at org.apache.cayenne.access.DataDomain.onQueryNoFilters(DataDomain.java:605)
>     at org.apache.cayenne.access.DataDomain$DataDomainQueryFilterChain.onQuery(DataDomain.java:838)
> Looks like Cayenne considers only entityId without entityIdentifier when try to load
the prefetch.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message