openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Roche (JIRA)" <j...@apache.org>
Subject [jira] [Created] (OPENJPA-2364) Slices: Bulk JPQL Deletes/Updates ignoring Target plugins and query hints.
Date Tue, 02 Apr 2013 16:37:15 GMT
Alan Roche created OPENJPA-2364:
-----------------------------------

             Summary: Slices: Bulk JPQL Deletes/Updates ignoring Target plugins and query
hints.
                 Key: OPENJPA-2364
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2364
             Project: OpenJPA
          Issue Type: Bug
          Components: slice
    Affects Versions: 2.2.1
            Reporter: Alan Roche
            Priority: Critical


I think there is a bug in OpenJPA Slices for Bulk Update Queries (At least for Bulk Delete
Statements).

So, if doing a bulk JPQL delete (E.G. "delete from Entity e where e.id in :ids"), - all slices
are hit with the query regardless of Policy plugins and Query hints set to target just one
slice.

I have implemented DistributionPolicy, FinderTargetPolicy and QueryTargetPolicy as well as
setting the "openjpa.hint.slice.Target" hint on the query and EntityManager.
All slices are hit regardless of the above when we need to just target 1 Slice. This causes
big problems for us, as some tables do not exist in all slices and queries fail.

Reproducing this is easy:
1/ Set up 2 slices
2/ Create table "Person" in slice A but NOT in slice B
3/ Register simple  DistributionPolicy, FinderTargetPolicy and QueryTargetPolicy plugins with
OpenJPA Slices, - all hard-coded to only return slice A.
4/ Execute JPQL delete "Delete from Person p where p.id = :id" with query hint to slice A
5/ See that the delete update query is executed against all slices not just slice A as required
by target plugins and query hint 
6/ Query fails against slice B because table does not exist in slice B. 

We have set query hints etc. - but returning slice A in QueryTargetPolicy should be enough


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message