Skip to content

Support bulk-fetch using JOIN #171

@andyjefferson

Description

@andyjefferson

If we have a JDOQL query like
SELECT FROM Person WHERE this.firstName == :value

then this becomes
SELECT P.* FROM PERSON P WHERE P.FIRST_NAME = ?

If a Person has a Set

then if the addresses field is in the fetch plan we already support a bulk-fetch mode "EXISTS" giving SQL of
SELECT A.* FROM ADDRESS A WHERE EXISTS (SELECT P.ID FROM PERSON P WHERE P.FIRST_NAME = ? AND A.PERSON_ID = P.ID)

We could potentially have a bulk-fetch mode "JOIN" as
SELECT A.* FROM PERSON P, ADDRESS A WHERE A.PERSON_ID = P.ID AND P.FIRST_NAME = ?

The reason why this is more complicated than the EXISTS case is that for EXISTS we can make use of the backing store getIteratorStatement for the basic statement, and then put the original query in an EXISTS clause. Here we need to start from the basic query (but clearing the select) and then adding the join to the element, while catering for all different combinations of set/list/collection whether with embedded elements or not, and whether via FK or JoinTable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions