Re: Delete by query

2007-08-01 Thread Christiaan des Bouvrie
Thanks for the information!

 

kind regards,

Christiaan



Re: Delete by query

2007-07-31 Thread Craig L Russell
Just a note on the completeness of the TCK. There are not many tests  
that are in place to test the behavior of deleting instances in this  
particular case (non-cascade, non-dependent, join table for one-many  
relationship).


We do plan on adding test cases in this general area for the JDO 2.1  
Maintenance Release.


Craig

On Jul 31, 2007, at 12:51 AM, Andy Jefferson wrote:


That would make sense to me as well. I indeed want
the entries in the PAGE table to remain there. I also thought there
should be no need in the .orm file to specify anything specific  
(like a
cascade delete) in order to have the corresponding entries in  
BOOK_PAGE
being deleted as well, according to the spec. The reason I asked  
is that

my current jdo vendor requires me to do this and is not convinced the
spec is clear about this.


The (JDO2) spec is clear enough IMHO, and the TCK is there to  
enforce the
spec. Is your current vendor passing the JDO2 TCK? If the vendor is  
not
convinced the spec is clear then they should raise it with the EG,  
and Apache
JDO. If they have an issue with a TCK test then they can raise a  
CHALLENGE on

the test in question. Very well defined process.


If there is "dependent-element" specified as true on the  
 then the
elements will also be deleted. If not, then it defaults to false  
and the
elements won't be deleted, just removed from the collection (hence  
any join
table entry removed). If it was a FK relation then the FK would be  
nulled

when dependent-element was false.


HTH
--
Andy  (Java Persistent Objects - http://www.jpox.org)


Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:[EMAIL PROTECTED]
P.S. A good JDO? O, Gasp!



smime.p7s
Description: S/MIME cryptographic signature


Re: Delete by query

2007-07-31 Thread Andy Jefferson
> That would make sense to me as well. I indeed want
> the entries in the PAGE table to remain there. I also thought there
> should be no need in the .orm file to specify anything specific (like a
> cascade delete) in order to have the corresponding entries in BOOK_PAGE
> being deleted as well, according to the spec. The reason I asked is that
> my current jdo vendor requires me to do this and is not convinced the
> spec is clear about this. 

The (JDO2) spec is clear enough IMHO, and the TCK is there to enforce the 
spec. Is your current vendor passing the JDO2 TCK? If the vendor is not 
convinced the spec is clear then they should raise it with the EG, and Apache 
JDO. If they have an issue with a TCK test then they can raise a CHALLENGE on 
the test in question. Very well defined process.


If there is "dependent-element" specified as true on the  then the 
elements will also be deleted. If not, then it defaults to false and the 
elements won't be deleted, just removed from the collection (hence any join 
table entry removed). If it was a FK relation then the FK would be nulled 
when dependent-element was false.


HTH
-- 
Andy  (Java Persistent Objects - http://www.jpox.org)


Re: Delete by query

2007-07-30 Thread Christiaan des Bouvrie
Hi David,

thanks for the reply! That would make sense to me as well. I indeed want
the entries in the PAGE table to remain there. I also thought there
should be no need in the .orm file to specify anything specific (like a
cascade delete) in order to have the corresponding entries in BOOK_PAGE
being deleted as well, according to the spec. The reason I asked is that
my current jdo vendor requires me to do this and is not convinced the
spec is clear about this.

 

Kind regards,

Christiaan

 



Re: Delete by query

2007-07-30 Thread David Ezzio
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 pages = new ArrayList(); 
> 
>  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.


Re: Delete by query

2007-07-30 Thread Christiaan des Bouvrie
Any ideas, suggestions?

 

Kind regards,

Christiaan



Delete by query

2007-07-19 Thread Christiaan des Bouvrie
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 pages = new ArrayList(); 

 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