Raul,

Can I please (again) ask you to open a Jira issue at 
http://jira.codehaus.org/browse/CASTOR, and attach a bug report (if possible). 
I'll make sure this wil be taken care of in due time ...

Regards
Werner 

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Sent: Mittwoch, 22. Februar 2006 10:30
> To: [email protected]
> Subject: [castor-user] problem deleting dependant objects
> 
> Helo,
> 
> We have found another problem with castor 1.0M2 that did not 
> occur in previous versions (at least in 0.9.5). Let me 
> explain an example:
> 
> Imagine we have two tables in a database such as those that follow:
> 
> CREATE TABLE TABLEPARENT (
>       IdParent   NUMBER(38)   NOT NULL);
> 
> ALTER TABLE TABLEPARENT ADD (
>       CONSTRAINT PK_TABLEPARENT PRIMARY KEY (IdParent);
> 
> CREATE TABLE TABLECHILD (
>       IdChild   NUMBER(38)   NOT NULL,
>       IdParent   NUMBER(38)   NOT NULL);
> 
> ALTER TABLE TABLECHILD ADD (
>       CONSTRAINT PK_TABLECHILD  PRIMARY KEY (IdChild);
> 
> ALTER TABLE TABLECHILD ADD (
>       CONSTRAINT FK_TABLECHILD FOREIGN KEY (IdParent ) 
> REFERENCES TABLEPARENT (IdParent));
> 
> Where the records from "TABLECHILD" as shown above depend on 
> the table "TABLEPARENT" by the primary key of the parent "IdParent".
> 
> These are translated into two models where "ChildModel" and 
> "ParentModel"
> are related by a member variable of "ChildModel", let's call 
> it "IdParent".
> Therefore, "ParentModel" do not have any references of its 
> child. The child know who is its father by its member 
> variable, "IdParent".
> 
> Imagine, now, that we want to delete a record "oParentModel" 
> from "TABLEPARENT", we must, first, delete its child from 
> "TABLECHILD". Let's say this parent only has one children, 
> "oChildModel".
> 
> Therefore, in the code, we do something like this (in the 
> order shown):
> 
> JDOManager.getDatabase().remove(oChildModel);
> JDOManager.getDatabase().remove(oParentModel);
> 
> So first, castor is told to remove the child record and 
> afterwards the parent one. If not, the database would throw a 
> "child record found" and will not allow us to delete the two models.
> 
> The problem is that castor does not seem to delete the models 
> in the order we tell it to do it. It seems, castor deletes 
> them in a random order because sometimes it throws a 
> SQLException and the next try not.
> 
> Thanks in advanced,
> 
> P.S.: Sorry, this time I have not spent time checking the 
> code so I can tell you exactly what it is happening, I could 
> not find time.
>                                     
>  CEIN, S.A.                         
>                                     
>  Raúl Sanz de Acedo Pérez           
>                                     
>  Técnico Sénior - Dpto. Innovación  
>  Empresarial                        
>                                     
>  [EMAIL PROTECTED]                      
>                                     
>  Polígono Mocholí - Plaza Cein,     
>  31110 Noáin                        
>                                     
> 
> 
> 
> 
> 
> 
> -------------------------------------------------
> If you wish to unsubscribe from this list, please send an 
> empty message to the following address:
> 
> [EMAIL PROTECTED]
> -------------------------------------------------
> 
> 
> 

-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to