[ 
https://issues.apache.org/jira/browse/JDO-617?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014982#comment-13014982
 ] 

Andy Jefferson commented on JDO-617:
------------------------------------

To make use of this bulk update/delete facility with the proposed Typesafe 
Query API (JDO-652) the following syntax would be used

TypesafeQuery<Team> tq = pm.newTypesafeQuery(Team.class);
QTeam cand = QTeam.jdoCandidate;
long numberUpdated = tq.filter(cand.name.eq("Barcelona")).set(cand.name, 
"Barcelona FC")).update();

TypesafeQuery<Team> tq = pm.newTypesafeQuery(Team.class);
QTeam cand = QTeam.jdoCandidate;
long numberDeleted = tq.filter(cand.name.eq("Barcelona")).delete();

Implemented in DataNucleus 3.0 M3

> JDOQL : Bulk Update and Delete Operations
> -----------------------------------------
>
>                 Key: JDO-617
>                 URL: https://issues.apache.org/jira/browse/JDO-617
>             Project: JDO
>          Issue Type: New Feature
>            Reporter: Eric SULTAN
>
> It would be usefull that the JDO Query Langage could do some UPDATE and 
> DELETE on Persistent Object like this :
> UPDATE [<candidate-class>] SET item1=<newValue>, item2=<newValue> [WHERE 
> <filter>]
> The new_value specified for an update operation must be compatible in type 
> with the state-field to
> which it is assigned.
> Bulk Update must modify the value of the version column and refresh Level1 
> and Level2 cache.
> DELETE FROM [<candidate-class>] [WHERE <filter>]
> By default Bulk Delete is appy on the specified class and its subclasses and 
> doesn't do cascade delete.
> A keyword like CASCADE must be set if we want to does a cascade delete : 
> DELETE CASCADE FROM [<candidate-class>] [WHERE <filter>]

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to