Please disregard my previous mail.
Found PersistenceBroker.store (Object, ObjectModification)
:-)


----- Original Message ----- 
From: "Andy Malakov" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, October 22, 2003 3:30 PM
Subject: + PersistenceBroker.insert (Object obj)


Guys,


Right now, when I call PersistenceBroker.store() it does extra DB lookup to determine 
if object is new or not.

... from PersistenceBrokerImpl.store (Object obj) ver.1.0RC4 ...

            // check if update or insert is needed
            boolean doInsert = false;
            // lookup cache or db to see whether object needs insert or update
            if (objectCache.lookup(oid) == null
                    && dbAccess.materializeObject(cld, oid) == null)
            {
                doInsert = true;
                // now store it:
            }
            store(obj, oid, cld, doInsert);


Is it possible to provide separate method in PersistenceBroker interface for inserting 
new objects and another method (save()   :-)
for updating existing ones?

A better way of doing this might be adding a method to class Identity that checks for 
not-null/not-zero primary keys in given
object.

Thanks,
Andy


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

Reply via email to