I was aware of the depends attribute, but I don’t want to use that because it would 
force me to update some things that I don’t really want/need to all of the time. Also, 
if I make the ticket depend on the user, or vice versa I can't load one by itself. 
i.e. if the ticket depends on the user, I would have to load the user and go through 
them to get any particular ticket. At least this is the behavior I have witnessed in 
the past when using the relations.

-Nick 

-----Original Message-----
From: Stein M. Hugubakken [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 05, 2004 5:19 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Not updating children...


Nick Stuart wrote:
> Is there a way to not have to update all of the related objects linked to the main 
> object that you are updating or creating? In other words right now I have to have 
> something like:
>             db.begin();
>             db.update(ticket.getTech());
>             db.update(ticket.getTech().getUserInfo());
>             db.update(ticket.getTech().getDepartment());
>             db.update(ticket.getPriority());
>             db.update(ticket.getCategory());
>             if(ticket.getEmployee() != ticket.getTech()){
>                 db.update(ticket.getEmployee()); 
>                 if(ticket.getEmployee().getUserInfo() != null)
>                     db.update(ticket.getEmployee().getUserInfo());
>             }
>             if(ticket.getTech().getDepartment() != 
> ticket.getEmployee().getDepartment()){
>                 db.update(ticket.getEmployee().getDepartment());
>             }
>             db.create(ticket);
>             db.commit();
>  
> What I would really like is if I could just do:
>             db.begin();
>             db.update(ticket.getTech());
>             db.update(ticket.getPriority());
>             db.update(ticket.getCategory());
>             if(ticket.getEmployee() != ticket.getTech()){
>                 db.update(ticket.getEmployee()); 
>             }
>             db.create(ticket);
>             db.commit();
>  
> Is there any way to do this or am I forced to go all the way through the relations, 
> if though this update doesn't affect some of the top level things like the 
> Department and such.
>  
> Thanks again for the help/suggestions.

You can use db.update(ticket.getTech()) to update Tech and it's related objects, but 
that depends on your mapping, can you post it?

Or you could take a look at this:
http://www.castor.org/castor-one.html#Dependent-and-related-relationships

Stein

-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a 
subject of:
        unsubscribe castor-dev



---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.648 / Virus Database: 415 - Release Date: 3/31/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.648 / Virus Database: 415 - Release Date: 3/31/2004
 

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to