db-jdo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Ezzio <dez...@bea.com>
Subject Re: Delete by query
Date Mon, 30 Jul 2007 14:37:53 GMT
Hi Christiaan,

The entries in the relationship table (BOOK_PAGE) should be deleted when 
the BOOK is deleted, but the entries in the PAGE table would remain 
unless you indicated that they were dependent.  The only purpose of the 
BOOK_PAGE table is to model the relationship and the relationship does 
not exist if the BOOK is deleted.

Does that help?

David



Christiaan des Bouvrie wrote:
> Hi,
> I have a question regarding delete by query. In the JDO 2.0 spec 14.8 it
> says:
> 
> "...These methods delete the instances of affected classes that pass the
> filter, and all dependent
> 
> instances...." To me it is not really clear what should be done in case
> such instance contains a List attribute. 
> 
>  
> 
> Suppose I have the following class structure:
> 
> 
> 
> Book {
>      List<Page> pages = new ArrayList<Page>(); 
> 
>      public void addPage(Page page) {
>              pages.add(page);
>      }
> }
> 
>  
> 
> Page {
> } 
> 
>  
> 
> Three tables will be created, one of them is the relation table
> Book_Pages. When I perform:
> pm.currentTransaction().begin();
> Query q = pm.newQuery(Book.class);
> q.deletePersistentAll();
> pm.currentTransaction().commit();
> 
> 
> 
> When deleting the book object, he rows in the relation table
> corresponding to this book should be deleted as well. Should I specify
> additional information in the .jdo or .orm to make this happen (eg.
> delete-action="cascade" for the relation table), or should this be done
> implicitly without specifying any additional info?
> 
>  
> 
> Kind regards,
> 
> Christiaan
> 
>  
> 
> 


Notice:  This email message, together with any attachments, may contain information  of  BEA
Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,  proprietary,
 copyrighted  and/or legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient, and have received
this message in error, please immediately return this by email and then delete it.

Mime
View raw message