cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Optimize cascade deletes
Date Sat, 22 Sep 2007 14:16:38 GMT

On Sep 22, 2007, at 4:41 PM, Giulio Cesare Solaroli wrote:
>
>>> The SQL I am expecting Cayenne to generate would look like this:
>>>
>>> delete from user_detail where id_user = <id of the user I want to
>>> delete>;
>>
>> Cayenne 3.0M2 (yet unreleased) supports such functionality via an
>> EJBQL query, but maybe you don't need to do direct DB deletion  
>> just yet.
>
> Where should I start looking to try to integrate the new revision of
> Cayenne in my project in order to take advantage of this feature?


Here is a few links that should help you to get started:

* Today's nightly build:  http://people.apache.org/~aadamchik/nightly/ 
09222007/
* The jars from the build that you need (cayenne-server.jar +  
dependencies): http://cayenne.apache.org/doc/jar-files-and- 
dependencies.html
* EJBQLQuery documentation: http://cayenne.apache.org/doc/ 
ejbqlquery.html
* Additional details of EJBQL syntax can be found in the JPA spec,  
Chapter 4: http://jcp.org/aboutJava/communityprocess/final/jsr220/ 
index.html

Your query may look like this:

   String ejbql = "delete from UserDetail ud where ud.user = :user";
   EJBQLQuery query = new EJBQLQuery(ejbql);
   query.setParameter("user", user);
   context.performGenericQuery(query);

Andrus




Mime
View raw message