Using b3,I have a table "AGENT" that has a one-to-many relation to a table 
"CAR". I have noticed that the performance
degregates dramatically whenever I want to add a new Car to the 
Agent.Debuging the code, I found that every time a Car
is added to the Agent, all the old Cars of this agent are resaved, which 
means that if the agent has 999 cars already and
I want to add just a new car, the save() method of the Car is called 1000 
times?!!!!!!!!!
here is the generated save method of the Agent that causes this problem. So 
my question is why would I need to save
the old "not-changed" Cars every car is added, Am I missing something, or is 
this a bug?

    public void save(DBConnection dbCon)
              throws TorqueException
    {
        if (!alreadyInSave)
        {
            alreadyInSave = true;

            // If this object has been modified, then save it to the 
database.
            if (isModified())
            {
                if (isNew())
                {
                    AgentPeer.doInsert((Agent) this, dbCon);
                    setNew(false);
                }
                else
                {
                    AgentPeer.doUpdate((Agent) this, dbCon);
                }
            }

            if (collCars != null)
            {
                for (int i = 0; i < collCars.size(); i++)
                {
                    ((Car) collCars.get(i)).save(dbCon);
                }
            }

            alreadyInSave = false;
        }
    }

best regards
Akmal



_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to