You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Byron Foster <bf...@base2.cc> on 2001/10/16 02:02:35 UTC

doPreSave() location change

Hello,

     Currently the call to doPreSave() is as follows in a Torque Java OM 
generated object:

    public void save(DBConnection dbCon) throws Exception
    {
        doPreSave();
        if (!alreadyInSave)
        {
          alreadyInSave = true;
 
However,  It seems to me it should be as follows:

    public void save(DBConnection dbCon) throws Exception
    {
        if (!alreadyInSave)
        {
          alreadyInSave = true;
          doPreSave();
 
This guarantees that doPreSave is only called one time before the 
actuall object is saved.  Otherwise you could have the situation that 
doPreSave is called twice or more times for a single save.  The former 
case seems like the preferred bahavior.

Thanks,
Byron








 



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org


Re: doPreSave() location change

Posted by Jon Stevens <jo...@latchkey.com>.
on 10/15/01 5:02 PM, "Byron Foster" <bf...@base2.cc> wrote:

> Hello,
> 
>    Currently the call to doPreSave() is as follows in a Torque Java OM
> generated object:
> 
>   public void save(DBConnection dbCon) throws Exception
>   {
>       doPreSave();
>       if (!alreadyInSave)
>       {
>         alreadyInSave = true;
> 
> However,  It seems to me it should be as follows:
> 
>   public void save(DBConnection dbCon) throws Exception
>   {
>       if (!alreadyInSave)
>       {
>         alreadyInSave = true;
>         doPreSave();
> 
> This guarantees that doPreSave is only called one time before the
> actuall object is saved.  Otherwise you could have the situation that
> doPreSave is called twice or more times for a single save.  The former
> case seems like the preferred bahavior.
> 
> Thanks,
> Byron

Even if it is broken, please don't start depending on those methods to be
around.

We just discussed this on the list.

-jon


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org