db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter S. Hamlen" <pham...@mail.com>
Subject Re: how to tell the bo that a foreign collection must be reloaded?
Date Tue, 18 Feb 2003 18:38:48 GMT
Well, depending on what you're doing, there are several answers:

1)  If you get the foreign object from the collObjects list, then you
don't need to do anything (because the object is still in the list and
has been changed in place.)

2)  If you're adding or removing foreign objects, then you may need to
reload the list.  
  a)   The easiest way is to use the addObject() and removeObject()
methods in the user object.  This automatically adds/removes the foreign
object from the collObjects list and no reload is necessary.
  b)  In the cases where (for whatever reason) you can't use the
addObject and removeObject functions, you may need to alter the base
Template that generates your classes.  We added a "clearCollection"
function to all our obejcts that clears these collObjects.  (I realize
this means altering the templates which people may not feel like doing.)

Hope this helps.

On Sat, 2003-02-15 at 18:12, Marc Lustig wrote:
> Hi,
> I have related an attribute of the user over the foreign key.
> The foreign objects are stored in the collObjects List.
> After I changed one of the related objects, what is the proper way to tell
> my user object that this object-collection needs to be updated (reloaded
> from db)?
> Problem is even if I call user.getObjects(new Criteria()) this doesn't make
> sure that the collection will be reloaded since the last request might also
> have used an empty criteria.
> Idea?
> Marc
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org

View raw message