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

Christiaan commented on JDO-617:
--------------------------------

There has been a (small) discussion on the UPDATE feature, just including it 
here as a reference (though it is probably better to split this issue into 2 
separate issues: update & delete):
http://www.nabble.com/Query-closures-for-JDO-2.2-to14107531.html#a1425437

I definitely like the cascade enhancement on bulk delete. You probably need 
some control over what should be cascade deleted so maybe it should be 
something like this:

DELETE CASCADE<fields> FROM [<candidate-class>] [WHERE <filter>] 

where fields should specify the objects to be deleted if the candidate-class 
has a field reference (specifying nothing would mean deleting all related 
objects?)  Traversal would be very cool as well, eg:

DELETE CASCADE address, employees, employees.roles FROM Company WHERE name = 
"mycompany"

Also, what about recursive deletion?:

DELETE CASCADE children FROM Node WHERE name = "test"  (children is again a 
collection of Node) 


> 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.
-
You can reply to this email to add a comment to the issue online.

Reply via email to