Oh, I'm sorry, the db.update not needed actualy. The history is, then
Castor was young and db.update throw LockNotGrantedException then method
update will changed to this:
  /**
   * Smart update for JDO object. First the worker load the persistense
object, then copy into it
   * values from o, and then commit database. This mechanizm works in
one transaction.
   * @param o Object to update
   */
  public void update(JDOObject o) {
    Database db = null;
    JDOObject persistent = null;
    try {
      db = getDatabase();
      db.begin();
      // Get persistence object
      persistent = (JDOObject)db.load(o.getClass(), getIdentity(o));
      // Copy fields to persistense object
      jdoObjectCopy(o, persistent);

      db.commit();
    } catch (Exception ex) {
      throw new JDOException("jdo.updateError", new Object[]{o}, ex);
    } finally {
      closeDatabase(db);
    }
  }

Just update in transaction. Sure, db.update not used...

I need a some rest, I guess :))

Sorry, again

-----Original Message-----
From: Bruce Snyder [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 15, 2003 8:03 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Long Transactions suggestion


AAE>Would be best if update doing just like this:
AAE>db.begin();
AAE>db.update(o);
AAE>db.commit();
AAE>
AAE>This also may implements by you, but more code needed:
AAE>You must implement method copyObj or somethink like this, also you 
AAE>needed method to get identity of object to load previos version.
AAE>
AAE>My resume about problems of long transaction:
AAE>1. I think, and it my private opinion, that providing aditional 
AAE>method in OQLQuery interface is not significant, becose it do not 
AAE>improve Castor performance as whole, but it maybe make life is 
AAE>easiest :)

Making life easier was the reason that this issue arose. 

AAE>2. This is requered method, becose otherside implementation of 
AAE>copyObj, may be slow or wrong logic, jperation of updating outside 
AAE>of transaction object is very important.

I'm not sure I follow the above statement. Please elaborate further. 

Bruce
-- 
perl -e 'print
unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

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

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

Reply via email to