Hi,

You are correct in that you *must* make modifications to the object inside
the odmg transaction. ODMG takes a snapshot of the state of object when it
locks it, and compares this snapshot to the state of the object on commit.
If they are different, the update takes place. If the object has not been
stored before, the insert will be executed.

This is how ODMG works (not OJB - this is how all implementations of ODMG
should probably work); it seems to me that you should probably look at using
the PersitenceBroker kernel directly.

Cheers,

Charles.



>-----Original Message-----
>From: Walid Ahmed [mailto:[EMAIL PROTECTED]]
>Sent: 13 September 2002 08:38
>To: [EMAIL PROTECTED]
>Subject: [ODMG] Problem with updating (while inserting new 
>works) PLEASE
>HELP
>
>
>Hi!
>
>I've spent now 5h on finding out the following behaviour:
>There is a significant difference between storing new objects 
>and storing existing but edited objects.
>The latter seems to work only if properties are edited between 
>the transaction beginning and the commitment. Right??
>I wanted to use the following method in a singleton ControlClass.
>
>    public void store(Object toBeStored) {
>        Database db = odmg.getDatabase(null); // the current DB
>        Transaction tx = null;
>            tx = odmg.newTransaction();
>            tx.begin();
>            tx.lock(toBeStored, tx.WRITE);
>            tx.commit();
>    }
>
>So in one case I put in a newly created Object (OID==0 ?) and 
>in another case its an object that I retrieve from DB to 
>change some properties.
>The first case works fine, but in the second I just get the following:
>
>[org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: 
>getObjectByIdentity de.itconcept.bbs.server.company.data.Address{21}
>
>But there is no UPDATE executed against the DB.
>Sometimes (!) its followed by a debug output about what SELECT 
>statement was used for getting an Address.
>
>What can I do?? I'dont want to move the transaction outside of 
>the store function. Are there possibilities to store Objects 
>without beginning  and comitting transactions?
>Can I use an alternative method than tx.lock(toBeStored,tx.WRITE) ?
>Why does db.makePersistent(toBeStored)  does'nt work either?
>
>Thank You all for helping
>
>Walid
>
>(Software-Ingenieur)
>
>IT-Concept 
>Gesellschaft f�r Informationstechnologie mbH
>fon :  +49 (0)30 - 34 09 45 56
>fax :  +49 (0)30 - 34 50 18 75
>web :  http://www.itconcept.de
>mail:  mailto:[EMAIL PROTECTED]
>_______________________________________________________________
>_______________
>Jetzt testen fur 1 Euro! Ihr All-in-one-Paket! 
>https://digitaledienste.web.de/Club/?mc=021106
>
>
>--
>To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


This email and any attachments are strictly confidential and are intended
solely for the addressee. If you are not the intended recipient you must
not disclose, forward, copy or take any action in reliance on this message
or its attachments. If you have received this email in error please notify
the sender as soon as possible and delete it from your computer systems.
Any views or opinions presented are solely those of the author and do not
necessarily reflect those of HPD Software Limited or its affiliates.

 At present the integrity of email across the internet cannot be guaranteed
and messages sent via this medium are potentially at risk.  All liability
is excluded to the extent permitted by law for any claims arising as a re-
sult of the use of this medium to transmit information by or to 
HPD Software Limited or its affiliates.



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

Reply via email to