You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Jody Grassel (JIRA)" <ji...@apache.org> on 2009/02/03 22:59:59 UTC

[jira] Created: (OPENJPA-894) LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3

LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3
-------------------------------------------------------------------------------------

                 Key: OPENJPA-894
                 URL: https://issues.apache.org/jira/browse/OPENJPA-894
             Project: OpenJPA
          Issue Type: Bug
          Components: query
    Affects Versions: 1.2.0
         Environment: Any, tested with Windows
            Reporter: Jody Grassel


Discovered what seems to be a break with JPA Specification 1.0, section 4.4.5.3 (Fetch Joins).  The query in question uses the  LEFT JOIN FETCH sematic, so there is the expectation that the result list will contain a copy of the entity reference for every match on the right side of the join (the spec uses the example with the query "SELECT d FROM department d LEFT JOIN FETCH d.employees WHERE d.deptno = 1" where 5 employees are members of department(pk=1) the resultlist should have 5 copies of Department(pk=1). )

Now, if I create all of the entities, persist them to the database, but do not clear the persistence context (leaving all the new entities managed by the persistence context still), the query performs as expected.  I get multiple copies of the entity I issued the query for, one for each item successfully matching the LEFT JOIN FETCH.  In the example I will update shortly, I get:

 [junit] --------------------------------------------------
 [junit] Executing testQuery001

 [junit] Executing named query getAGroup with intData=42 ...
 [junit] ResultList size: 8
 [junit] 1 EntityA(id=1): 42, Entity A - PK 1
 [junit] 1 EntityA(id=1): 42, Entity A - PK 1
 [junit] 1 EntityA(id=1): 42, Entity A - PK 1
 [junit] 1 EntityA(id=1): 42, Entity A - PK 1
 [junit] 1 EntityA(id=2): 42, Entity A - PK 2
 [junit] 1 EntityA(id=2): 42, Entity A - PK 2
 [junit] 1 EntityA(id=2): 42, Entity A - PK 2
 [junit] 1 EntityA(id=2): 42, Entity A - PK 2


However, if I clear the persistence context, forcing OpenJPA to make a fetch from the database, I only get unique instances of the entity I issued the query for, not multiple copies for each match on the right side of the join.

[junit] --------------------------------------------------
[junit] Executing testQuery002

[junit] Clearing persistence context...
[junit] Executing named query getAGroup with intData=42 ...
[junit] ResultList size: 2
[junit] 1 EntityA(id=1): 42, Entity A - PK 1
[junit] 1 EntityA(id=2): 42, Entity A - PK 2

Both tests use the exact same code for everything, except testQuery002 does a em.clear() before running the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-894) LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-894:
---------------------------------

    Attachment: OPENJPA-894-scrollable-1.0.x.patch.txt

The idea of manually adding in the duplicates made me a little nervous. I've attached an alternate approach which uses scrollable result sets if we detect a left join fetch (as indicated by the presence of joins in the fetch plan).

When a Left Join Fetch is used we'll process the resultSet as we normally do, but rewind back to the original position after processing the eager results. The changes should only affect LJF queries which might see a slight drop in performance for using scrollable result sets. 


> LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3
> -------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-894
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-894
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.2.0
>         Environment: Any, tested with Windows
>            Reporter: Jody Grassel
>         Attachments: FetchJoinTest.zip, OPENJPA-894-scrollable-1.0.x.patch.txt, OPENJPA-894.patch
>
>
> Discovered what seems to be a break with JPA Specification 1.0, section 4.4.5.3 (Fetch Joins).  The query in question uses the  LEFT JOIN FETCH sematic, so there is the expectation that the result list will contain a copy of the entity reference for every match on the right side of the join (the spec uses the example with the query "SELECT d FROM department d LEFT JOIN FETCH d.employees WHERE d.deptno = 1" where 5 employees are members of department(pk=1) the resultlist should have 5 copies of Department(pk=1). )
> Now, if I create all of the entities, persist them to the database, but do not clear the persistence context (leaving all the new entities managed by the persistence context still), the query performs as expected.  I get multiple copies of the entity I issued the query for, one for each item successfully matching the LEFT JOIN FETCH.  In the example I will update shortly, I get:
>  [junit] --------------------------------------------------
>  [junit] Executing testQuery001
>  [junit] Executing named query getAGroup with intData=42 ...
>  [junit] ResultList size: 8
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> However, if I clear the persistence context, forcing OpenJPA to make a fetch from the database, I only get unique instances of the entity I issued the query for, not multiple copies for each match on the right side of the join.
> [junit] --------------------------------------------------
> [junit] Executing testQuery002
> [junit] Clearing persistence context...
> [junit] Executing named query getAGroup with intData=42 ...
> [junit] ResultList size: 2
> [junit] 1 EntityA(id=1): 42, Entity A - PK 1
> [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> Both tests use the exact same code for everything, except testQuery002 does a em.clear() before running the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-894) LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-894:
---------------------------------

    Attachment:     (was: OPENJPA-894-scrollable-trunk.patch.txt)

> LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3
> -------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-894
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-894
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.0.3, 1.2.0, 1.3.0, 2.0.0
>         Environment: Any, tested with Windows
>            Reporter: Jody Grassel
>            Assignee: Michael Dick
>         Attachments: FetchJoinTest.zip, OPENJPA-894.patch
>
>
> Discovered what seems to be a break with JPA Specification 1.0, section 4.4.5.3 (Fetch Joins).  The query in question uses the  LEFT JOIN FETCH sematic, so there is the expectation that the result list will contain a copy of the entity reference for every match on the right side of the join (the spec uses the example with the query "SELECT d FROM department d LEFT JOIN FETCH d.employees WHERE d.deptno = 1" where 5 employees are members of department(pk=1) the resultlist should have 5 copies of Department(pk=1). )
> Now, if I create all of the entities, persist them to the database, but do not clear the persistence context (leaving all the new entities managed by the persistence context still), the query performs as expected.  I get multiple copies of the entity I issued the query for, one for each item successfully matching the LEFT JOIN FETCH.  In the example I will update shortly, I get:
>  [junit] --------------------------------------------------
>  [junit] Executing testQuery001
>  [junit] Executing named query getAGroup with intData=42 ...
>  [junit] ResultList size: 8
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> However, if I clear the persistence context, forcing OpenJPA to make a fetch from the database, I only get unique instances of the entity I issued the query for, not multiple copies for each match on the right side of the join.
> [junit] --------------------------------------------------
> [junit] Executing testQuery002
> [junit] Clearing persistence context...
> [junit] Executing named query getAGroup with intData=42 ...
> [junit] ResultList size: 2
> [junit] 1 EntityA(id=1): 42, Entity A - PK 1
> [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> Both tests use the exact same code for everything, except testQuery002 does a em.clear() before running the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-894) LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-894:
---------------------------------

    Attachment:     (was: OPENJPA-894-scrollable-1.2.x.patch.txt)

> LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3
> -------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-894
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-894
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.0.3, 1.2.0, 1.3.0, 2.0.0
>         Environment: Any, tested with Windows
>            Reporter: Jody Grassel
>            Assignee: Michael Dick
>         Attachments: FetchJoinTest.zip, OPENJPA-894.patch
>
>
> Discovered what seems to be a break with JPA Specification 1.0, section 4.4.5.3 (Fetch Joins).  The query in question uses the  LEFT JOIN FETCH sematic, so there is the expectation that the result list will contain a copy of the entity reference for every match on the right side of the join (the spec uses the example with the query "SELECT d FROM department d LEFT JOIN FETCH d.employees WHERE d.deptno = 1" where 5 employees are members of department(pk=1) the resultlist should have 5 copies of Department(pk=1). )
> Now, if I create all of the entities, persist them to the database, but do not clear the persistence context (leaving all the new entities managed by the persistence context still), the query performs as expected.  I get multiple copies of the entity I issued the query for, one for each item successfully matching the LEFT JOIN FETCH.  In the example I will update shortly, I get:
>  [junit] --------------------------------------------------
>  [junit] Executing testQuery001
>  [junit] Executing named query getAGroup with intData=42 ...
>  [junit] ResultList size: 8
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> However, if I clear the persistence context, forcing OpenJPA to make a fetch from the database, I only get unique instances of the entity I issued the query for, not multiple copies for each match on the right side of the join.
> [junit] --------------------------------------------------
> [junit] Executing testQuery002
> [junit] Clearing persistence context...
> [junit] Executing named query getAGroup with intData=42 ...
> [junit] ResultList size: 2
> [junit] 1 EntityA(id=1): 42, Entity A - PK 1
> [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> Both tests use the exact same code for everything, except testQuery002 does a em.clear() before running the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-894) LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-894:
---------------------------------

    Affects Version/s: 2.0.0
                       1.3.0
                       1.0.3

> LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3
> -------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-894
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-894
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.0.3, 1.2.0, 1.3.0, 2.0.0
>         Environment: Any, tested with Windows
>            Reporter: Jody Grassel
>            Assignee: Michael Dick
>         Attachments: FetchJoinTest.zip, OPENJPA-894-scrollable-1.0.x.patch.txt, OPENJPA-894-scrollable-1.2.x.patch.txt, OPENJPA-894-scrollable-1.3.x.patch.txt, OPENJPA-894-scrollable-trunk.patch.txt, OPENJPA-894.patch
>
>
> Discovered what seems to be a break with JPA Specification 1.0, section 4.4.5.3 (Fetch Joins).  The query in question uses the  LEFT JOIN FETCH sematic, so there is the expectation that the result list will contain a copy of the entity reference for every match on the right side of the join (the spec uses the example with the query "SELECT d FROM department d LEFT JOIN FETCH d.employees WHERE d.deptno = 1" where 5 employees are members of department(pk=1) the resultlist should have 5 copies of Department(pk=1). )
> Now, if I create all of the entities, persist them to the database, but do not clear the persistence context (leaving all the new entities managed by the persistence context still), the query performs as expected.  I get multiple copies of the entity I issued the query for, one for each item successfully matching the LEFT JOIN FETCH.  In the example I will update shortly, I get:
>  [junit] --------------------------------------------------
>  [junit] Executing testQuery001
>  [junit] Executing named query getAGroup with intData=42 ...
>  [junit] ResultList size: 8
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> However, if I clear the persistence context, forcing OpenJPA to make a fetch from the database, I only get unique instances of the entity I issued the query for, not multiple copies for each match on the right side of the join.
> [junit] --------------------------------------------------
> [junit] Executing testQuery002
> [junit] Clearing persistence context...
> [junit] Executing named query getAGroup with intData=42 ...
> [junit] ResultList size: 2
> [junit] 1 EntityA(id=1): 42, Entity A - PK 1
> [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> Both tests use the exact same code for everything, except testQuery002 does a em.clear() before running the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-894) LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3

Posted by "Fay Wang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Fay Wang updated OPENJPA-894:
-----------------------------

    Attachment: OPENJPA-894.patch

The attached patch fixes the inconsistent behavior reported by Jody. The resulting behavior conforms with the JPA spec, i.e., duplicate references are returned with JOIN FETCH.

> LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3
> -------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-894
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-894
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.2.0
>         Environment: Any, tested with Windows
>            Reporter: Jody Grassel
>         Attachments: FetchJoinTest.zip, OPENJPA-894.patch
>
>
> Discovered what seems to be a break with JPA Specification 1.0, section 4.4.5.3 (Fetch Joins).  The query in question uses the  LEFT JOIN FETCH sematic, so there is the expectation that the result list will contain a copy of the entity reference for every match on the right side of the join (the spec uses the example with the query "SELECT d FROM department d LEFT JOIN FETCH d.employees WHERE d.deptno = 1" where 5 employees are members of department(pk=1) the resultlist should have 5 copies of Department(pk=1). )
> Now, if I create all of the entities, persist them to the database, but do not clear the persistence context (leaving all the new entities managed by the persistence context still), the query performs as expected.  I get multiple copies of the entity I issued the query for, one for each item successfully matching the LEFT JOIN FETCH.  In the example I will update shortly, I get:
>  [junit] --------------------------------------------------
>  [junit] Executing testQuery001
>  [junit] Executing named query getAGroup with intData=42 ...
>  [junit] ResultList size: 8
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> However, if I clear the persistence context, forcing OpenJPA to make a fetch from the database, I only get unique instances of the entity I issued the query for, not multiple copies for each match on the right side of the join.
> [junit] --------------------------------------------------
> [junit] Executing testQuery002
> [junit] Clearing persistence context...
> [junit] Executing named query getAGroup with intData=42 ...
> [junit] ResultList size: 2
> [junit] 1 EntityA(id=1): 42, Entity A - PK 1
> [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> Both tests use the exact same code for everything, except testQuery002 does a em.clear() before running the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-894) LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3

Posted by "Milosz Tylenda (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Milosz Tylenda updated OPENJPA-894:
-----------------------------------

    Patch Info: [Patch Available]

> LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3
> -------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-894
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-894
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.2.0
>         Environment: Any, tested with Windows
>            Reporter: Jody Grassel
>         Attachments: FetchJoinTest.zip, OPENJPA-894.patch
>
>
> Discovered what seems to be a break with JPA Specification 1.0, section 4.4.5.3 (Fetch Joins).  The query in question uses the  LEFT JOIN FETCH sematic, so there is the expectation that the result list will contain a copy of the entity reference for every match on the right side of the join (the spec uses the example with the query "SELECT d FROM department d LEFT JOIN FETCH d.employees WHERE d.deptno = 1" where 5 employees are members of department(pk=1) the resultlist should have 5 copies of Department(pk=1). )
> Now, if I create all of the entities, persist them to the database, but do not clear the persistence context (leaving all the new entities managed by the persistence context still), the query performs as expected.  I get multiple copies of the entity I issued the query for, one for each item successfully matching the LEFT JOIN FETCH.  In the example I will update shortly, I get:
>  [junit] --------------------------------------------------
>  [junit] Executing testQuery001
>  [junit] Executing named query getAGroup with intData=42 ...
>  [junit] ResultList size: 8
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> However, if I clear the persistence context, forcing OpenJPA to make a fetch from the database, I only get unique instances of the entity I issued the query for, not multiple copies for each match on the right side of the join.
> [junit] --------------------------------------------------
> [junit] Executing testQuery002
> [junit] Clearing persistence context...
> [junit] Executing named query getAGroup with intData=42 ...
> [junit] ResultList size: 2
> [junit] 1 EntityA(id=1): 42, Entity A - PK 1
> [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> Both tests use the exact same code for everything, except testQuery002 does a em.clear() before running the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-894) LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3

Posted by "Jody Grassel (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jody Grassel updated OPENJPA-894:
---------------------------------

    Attachment: FetchJoinTest.zip

The ant script testbuild.xml can be used to invoke the test.  You will need to make modifications to it and the persistence.xml to match your test environment (such as db info and libraries for junit, openjpa, and supporting libraries.)

> LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3
> -------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-894
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-894
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.2.0
>         Environment: Any, tested with Windows
>            Reporter: Jody Grassel
>         Attachments: FetchJoinTest.zip
>
>
> Discovered what seems to be a break with JPA Specification 1.0, section 4.4.5.3 (Fetch Joins).  The query in question uses the  LEFT JOIN FETCH sematic, so there is the expectation that the result list will contain a copy of the entity reference for every match on the right side of the join (the spec uses the example with the query "SELECT d FROM department d LEFT JOIN FETCH d.employees WHERE d.deptno = 1" where 5 employees are members of department(pk=1) the resultlist should have 5 copies of Department(pk=1). )
> Now, if I create all of the entities, persist them to the database, but do not clear the persistence context (leaving all the new entities managed by the persistence context still), the query performs as expected.  I get multiple copies of the entity I issued the query for, one for each item successfully matching the LEFT JOIN FETCH.  In the example I will update shortly, I get:
>  [junit] --------------------------------------------------
>  [junit] Executing testQuery001
>  [junit] Executing named query getAGroup with intData=42 ...
>  [junit] ResultList size: 8
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> However, if I clear the persistence context, forcing OpenJPA to make a fetch from the database, I only get unique instances of the entity I issued the query for, not multiple copies for each match on the right side of the join.
> [junit] --------------------------------------------------
> [junit] Executing testQuery002
> [junit] Clearing persistence context...
> [junit] Executing named query getAGroup with intData=42 ...
> [junit] ResultList size: 2
> [junit] 1 EntityA(id=1): 42, Entity A - PK 1
> [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> Both tests use the exact same code for everything, except testQuery002 does a em.clear() before running the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-894) LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-894:
---------------------------------

    Attachment: OPENJPA-894-scrollable-1.0.x.patch.txt

Adding testcase changes to current patch. Testcases came from Patrick's commit to trunk under revision 627979, and really boil down to just TestEJBJoins + supporting classes. 

> LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3
> -------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-894
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-894
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.2.0
>         Environment: Any, tested with Windows
>            Reporter: Jody Grassel
>            Assignee: Michael Dick
>         Attachments: FetchJoinTest.zip, OPENJPA-894-scrollable-1.0.x.patch.txt, OPENJPA-894.patch
>
>
> Discovered what seems to be a break with JPA Specification 1.0, section 4.4.5.3 (Fetch Joins).  The query in question uses the  LEFT JOIN FETCH sematic, so there is the expectation that the result list will contain a copy of the entity reference for every match on the right side of the join (the spec uses the example with the query "SELECT d FROM department d LEFT JOIN FETCH d.employees WHERE d.deptno = 1" where 5 employees are members of department(pk=1) the resultlist should have 5 copies of Department(pk=1). )
> Now, if I create all of the entities, persist them to the database, but do not clear the persistence context (leaving all the new entities managed by the persistence context still), the query performs as expected.  I get multiple copies of the entity I issued the query for, one for each item successfully matching the LEFT JOIN FETCH.  In the example I will update shortly, I get:
>  [junit] --------------------------------------------------
>  [junit] Executing testQuery001
>  [junit] Executing named query getAGroup with intData=42 ...
>  [junit] ResultList size: 8
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> However, if I clear the persistence context, forcing OpenJPA to make a fetch from the database, I only get unique instances of the entity I issued the query for, not multiple copies for each match on the right side of the join.
> [junit] --------------------------------------------------
> [junit] Executing testQuery002
> [junit] Clearing persistence context...
> [junit] Executing named query getAGroup with intData=42 ...
> [junit] ResultList size: 2
> [junit] 1 EntityA(id=1): 42, Entity A - PK 1
> [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> Both tests use the exact same code for everything, except testQuery002 does a em.clear() before running the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-894) LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-894:
---------------------------------

    Attachment:     (was: OPENJPA-894-scrollable-1.0.x.patch.txt)

> LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3
> -------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-894
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-894
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.2.0
>         Environment: Any, tested with Windows
>            Reporter: Jody Grassel
>            Assignee: Michael Dick
>         Attachments: FetchJoinTest.zip, OPENJPA-894.patch
>
>
> Discovered what seems to be a break with JPA Specification 1.0, section 4.4.5.3 (Fetch Joins).  The query in question uses the  LEFT JOIN FETCH sematic, so there is the expectation that the result list will contain a copy of the entity reference for every match on the right side of the join (the spec uses the example with the query "SELECT d FROM department d LEFT JOIN FETCH d.employees WHERE d.deptno = 1" where 5 employees are members of department(pk=1) the resultlist should have 5 copies of Department(pk=1). )
> Now, if I create all of the entities, persist them to the database, but do not clear the persistence context (leaving all the new entities managed by the persistence context still), the query performs as expected.  I get multiple copies of the entity I issued the query for, one for each item successfully matching the LEFT JOIN FETCH.  In the example I will update shortly, I get:
>  [junit] --------------------------------------------------
>  [junit] Executing testQuery001
>  [junit] Executing named query getAGroup with intData=42 ...
>  [junit] ResultList size: 8
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> However, if I clear the persistence context, forcing OpenJPA to make a fetch from the database, I only get unique instances of the entity I issued the query for, not multiple copies for each match on the right side of the join.
> [junit] --------------------------------------------------
> [junit] Executing testQuery002
> [junit] Clearing persistence context...
> [junit] Executing named query getAGroup with intData=42 ...
> [junit] ResultList size: 2
> [junit] 1 EntityA(id=1): 42, Entity A - PK 1
> [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> Both tests use the exact same code for everything, except testQuery002 does a em.clear() before running the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-894) LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-894:
---------------------------------

    Assignee: Fay Wang  (was: Michael Dick)

Assigning to Fay, her patch is a better solution than mine were. 

> LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3
> -------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-894
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-894
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.0.3, 1.2.0, 1.3.0, 2.0.0
>         Environment: Any, tested with Windows
>            Reporter: Jody Grassel
>            Assignee: Fay Wang
>         Attachments: FetchJoinTest.zip, OPENJPA-894.patch
>
>
> Discovered what seems to be a break with JPA Specification 1.0, section 4.4.5.3 (Fetch Joins).  The query in question uses the  LEFT JOIN FETCH sematic, so there is the expectation that the result list will contain a copy of the entity reference for every match on the right side of the join (the spec uses the example with the query "SELECT d FROM department d LEFT JOIN FETCH d.employees WHERE d.deptno = 1" where 5 employees are members of department(pk=1) the resultlist should have 5 copies of Department(pk=1). )
> Now, if I create all of the entities, persist them to the database, but do not clear the persistence context (leaving all the new entities managed by the persistence context still), the query performs as expected.  I get multiple copies of the entity I issued the query for, one for each item successfully matching the LEFT JOIN FETCH.  In the example I will update shortly, I get:
>  [junit] --------------------------------------------------
>  [junit] Executing testQuery001
>  [junit] Executing named query getAGroup with intData=42 ...
>  [junit] ResultList size: 8
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> However, if I clear the persistence context, forcing OpenJPA to make a fetch from the database, I only get unique instances of the entity I issued the query for, not multiple copies for each match on the right side of the join.
> [junit] --------------------------------------------------
> [junit] Executing testQuery002
> [junit] Clearing persistence context...
> [junit] Executing named query getAGroup with intData=42 ...
> [junit] ResultList size: 2
> [junit] 1 EntityA(id=1): 42, Entity A - PK 1
> [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> Both tests use the exact same code for everything, except testQuery002 does a em.clear() before running the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (OPENJPA-894) LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick reassigned OPENJPA-894:
------------------------------------

    Assignee: Michael Dick

> LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3
> -------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-894
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-894
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.2.0
>         Environment: Any, tested with Windows
>            Reporter: Jody Grassel
>            Assignee: Michael Dick
>         Attachments: FetchJoinTest.zip, OPENJPA-894-scrollable-1.0.x.patch.txt, OPENJPA-894.patch
>
>
> Discovered what seems to be a break with JPA Specification 1.0, section 4.4.5.3 (Fetch Joins).  The query in question uses the  LEFT JOIN FETCH sematic, so there is the expectation that the result list will contain a copy of the entity reference for every match on the right side of the join (the spec uses the example with the query "SELECT d FROM department d LEFT JOIN FETCH d.employees WHERE d.deptno = 1" where 5 employees are members of department(pk=1) the resultlist should have 5 copies of Department(pk=1). )
> Now, if I create all of the entities, persist them to the database, but do not clear the persistence context (leaving all the new entities managed by the persistence context still), the query performs as expected.  I get multiple copies of the entity I issued the query for, one for each item successfully matching the LEFT JOIN FETCH.  In the example I will update shortly, I get:
>  [junit] --------------------------------------------------
>  [junit] Executing testQuery001
>  [junit] Executing named query getAGroup with intData=42 ...
>  [junit] ResultList size: 8
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> However, if I clear the persistence context, forcing OpenJPA to make a fetch from the database, I only get unique instances of the entity I issued the query for, not multiple copies for each match on the right side of the join.
> [junit] --------------------------------------------------
> [junit] Executing testQuery002
> [junit] Clearing persistence context...
> [junit] Executing named query getAGroup with intData=42 ...
> [junit] ResultList size: 2
> [junit] 1 EntityA(id=1): 42, Entity A - PK 1
> [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> Both tests use the exact same code for everything, except testQuery002 does a em.clear() before running the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-894) LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-894:
---------------------------------

    Attachment:     (was: OPENJPA-894-scrollable-1.3.x.patch.txt)

> LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3
> -------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-894
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-894
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.0.3, 1.2.0, 1.3.0, 2.0.0
>         Environment: Any, tested with Windows
>            Reporter: Jody Grassel
>            Assignee: Michael Dick
>         Attachments: FetchJoinTest.zip, OPENJPA-894.patch
>
>
> Discovered what seems to be a break with JPA Specification 1.0, section 4.4.5.3 (Fetch Joins).  The query in question uses the  LEFT JOIN FETCH sematic, so there is the expectation that the result list will contain a copy of the entity reference for every match on the right side of the join (the spec uses the example with the query "SELECT d FROM department d LEFT JOIN FETCH d.employees WHERE d.deptno = 1" where 5 employees are members of department(pk=1) the resultlist should have 5 copies of Department(pk=1). )
> Now, if I create all of the entities, persist them to the database, but do not clear the persistence context (leaving all the new entities managed by the persistence context still), the query performs as expected.  I get multiple copies of the entity I issued the query for, one for each item successfully matching the LEFT JOIN FETCH.  In the example I will update shortly, I get:
>  [junit] --------------------------------------------------
>  [junit] Executing testQuery001
>  [junit] Executing named query getAGroup with intData=42 ...
>  [junit] ResultList size: 8
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> However, if I clear the persistence context, forcing OpenJPA to make a fetch from the database, I only get unique instances of the entity I issued the query for, not multiple copies for each match on the right side of the join.
> [junit] --------------------------------------------------
> [junit] Executing testQuery002
> [junit] Clearing persistence context...
> [junit] Executing named query getAGroup with intData=42 ...
> [junit] ResultList size: 2
> [junit] 1 EntityA(id=1): 42, Entity A - PK 1
> [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> Both tests use the exact same code for everything, except testQuery002 does a em.clear() before running the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-894) LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-894:
---------------------------------

    Attachment: OPENJPA-894-scrollable-1.3.x.patch.txt
                OPENJPA-894-scrollable-trunk.patch.txt
                OPENJPA-894-scrollable-1.2.x.patch.txt

Attaching patches for 1.2.x, 1.3.x and trunk. 

There's a known issue with TestLibService on trunk, a query using a JOIN FETCH expects one result (which is incorrect). There are a couple of options for resolving the problem which I'll bring up on the dev mailing list. 

> LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3
> -------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-894
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-894
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.2.0
>         Environment: Any, tested with Windows
>            Reporter: Jody Grassel
>            Assignee: Michael Dick
>         Attachments: FetchJoinTest.zip, OPENJPA-894-scrollable-1.0.x.patch.txt, OPENJPA-894-scrollable-1.2.x.patch.txt, OPENJPA-894-scrollable-1.3.x.patch.txt, OPENJPA-894-scrollable-trunk.patch.txt, OPENJPA-894.patch
>
>
> Discovered what seems to be a break with JPA Specification 1.0, section 4.4.5.3 (Fetch Joins).  The query in question uses the  LEFT JOIN FETCH sematic, so there is the expectation that the result list will contain a copy of the entity reference for every match on the right side of the join (the spec uses the example with the query "SELECT d FROM department d LEFT JOIN FETCH d.employees WHERE d.deptno = 1" where 5 employees are members of department(pk=1) the resultlist should have 5 copies of Department(pk=1). )
> Now, if I create all of the entities, persist them to the database, but do not clear the persistence context (leaving all the new entities managed by the persistence context still), the query performs as expected.  I get multiple copies of the entity I issued the query for, one for each item successfully matching the LEFT JOIN FETCH.  In the example I will update shortly, I get:
>  [junit] --------------------------------------------------
>  [junit] Executing testQuery001
>  [junit] Executing named query getAGroup with intData=42 ...
>  [junit] ResultList size: 8
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> However, if I clear the persistence context, forcing OpenJPA to make a fetch from the database, I only get unique instances of the entity I issued the query for, not multiple copies for each match on the right side of the join.
> [junit] --------------------------------------------------
> [junit] Executing testQuery002
> [junit] Clearing persistence context...
> [junit] Executing named query getAGroup with intData=42 ...
> [junit] ResultList size: 2
> [junit] 1 EntityA(id=1): 42, Entity A - PK 1
> [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> Both tests use the exact same code for everything, except testQuery002 does a em.clear() before running the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENJPA-894) LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3

Posted by "Michael Dick (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-894?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Dick updated OPENJPA-894:
---------------------------------

    Attachment:     (was: OPENJPA-894-scrollable-1.0.x.patch.txt)

> LEFT JOIN FETCH queries with fresh fetches from the db do not follow JPA Spec 4.4.5.3
> -------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-894
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-894
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: query
>    Affects Versions: 1.0.3, 1.2.0, 1.3.0, 2.0.0
>         Environment: Any, tested with Windows
>            Reporter: Jody Grassel
>            Assignee: Michael Dick
>         Attachments: FetchJoinTest.zip, OPENJPA-894.patch
>
>
> Discovered what seems to be a break with JPA Specification 1.0, section 4.4.5.3 (Fetch Joins).  The query in question uses the  LEFT JOIN FETCH sematic, so there is the expectation that the result list will contain a copy of the entity reference for every match on the right side of the join (the spec uses the example with the query "SELECT d FROM department d LEFT JOIN FETCH d.employees WHERE d.deptno = 1" where 5 employees are members of department(pk=1) the resultlist should have 5 copies of Department(pk=1). )
> Now, if I create all of the entities, persist them to the database, but do not clear the persistence context (leaving all the new entities managed by the persistence context still), the query performs as expected.  I get multiple copies of the entity I issued the query for, one for each item successfully matching the LEFT JOIN FETCH.  In the example I will update shortly, I get:
>  [junit] --------------------------------------------------
>  [junit] Executing testQuery001
>  [junit] Executing named query getAGroup with intData=42 ...
>  [junit] ResultList size: 8
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=1): 42, Entity A - PK 1
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
>  [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> However, if I clear the persistence context, forcing OpenJPA to make a fetch from the database, I only get unique instances of the entity I issued the query for, not multiple copies for each match on the right side of the join.
> [junit] --------------------------------------------------
> [junit] Executing testQuery002
> [junit] Clearing persistence context...
> [junit] Executing named query getAGroup with intData=42 ...
> [junit] ResultList size: 2
> [junit] 1 EntityA(id=1): 42, Entity A - PK 1
> [junit] 1 EntityA(id=2): 42, Entity A - PK 2
> Both tests use the exact same code for everything, except testQuery002 does a em.clear() before running the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.