[ https://issues.apache.org/jira/browse/CAY-2257?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tomas Jura updated CAY-2257: ---------------------------- Attachment: commit_log.txt > Prefetch with joint semantics looses data > ----------------------------------------- > > Key: CAY-2257 > URL: https://issues.apache.org/jira/browse/CAY-2257 > Project: Cayenne > Issue Type: Bug > Components: Core Library > Affects Versions: 4.0.M3, 4.0.M5 > Environment: MacOs Sierra, Posgres 9.5.4 > Reporter: Alexei Grigoriev > Assignee: Nikita Timofeev > Priority: Major > Attachments: commit_log.txt > > > Cayenne fails to fill detail collections when master is an abstract class. > So for query > {code:java} > SelectQuery<Master> prefetchSelectQuery = SelectQuery.query(Master.class); > prefetchSelectQuery.addPrefetch("details").setSemantics(PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS); > {code} > details fetched as expected. > {code:java} > SelectQuery<Master> prefetchSelectQuery = SelectQuery.query(Master.class); > prefetchSelectQuery.addPrefetch("details").setSemantics(PrefetchTreeNode.DISJOINT_PREFETCH_SEMANTICS); > {code} > returns empty collections for details. But log shows that all queries > executed and expected number of rows returned. > for concrete class {code:java}SelectQuery<ConcreteMaster> prefetchSelectQuery > = SelectQuery.query(ConcreteMaster.class);{code} > both cases work as expected > See my model: > {code:xml} > <db-entity name="master"> > <db-attribute name="master_id" type="BIGINT" isPrimaryKey="true" > isMandatory="true"/> > <db-attribute name="type" type="VARCHAR" isMandatory="true" > length="32"/> > </db-entity> > <db-entity name="detail"> > <db-attribute name="detail_id" type="BIGINT" isPrimaryKey="true" > isMandatory="true"/> > <db-attribute name="master_id" type="BIGINT" isMandatory="true"/> > </db-entity> > <obj-entity name="Master" abstract="true" className="model.Master" > lock-type="optimistic" dbEntityName="master"> > <obj-attribute name="type" type="model.enumeration.type.MasterType" > db-attribute-path="type"/> > <obj-entity name="ConcreteMaster" superEntityName="Master" > className="model.ConcreteMaster" lock-type="optimistic"> > <qualifier><![CDATA[type = "CONCRETE_MASTER"]]</qualifier> > </obj-entity> > <obj-entity name="Detail" className="model.Detail" lock-type="optimistic" > dbEntityName="detail"> > <obj-attribute name="masterId" type="java.lang.Long" > db-attribute-path="master_id"/> > </obj-entity> > <db-relationship name="master" source="detail" target="master" toMany="false"> > <db-attribute-pair source="master_id" target="detail_id"/> > </db-relationship> > <db-relationship name="details" source="master" target="detail" toMany="true"> > <db-attribute-pair source="detail_id" target="master_id"/> > </db-relationship> > <obj-relationship name="master" source="Detail" target="Master" > deleteRule="Nullify" db-relationship-path="master"/> > <obj-relationship name="details" source="Master" target="Detail" > deleteRule="Cascade" db-relationship-path="details"/> > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)