Hi Emmanuel,

AFAIK it shouldn't matter when you acquire a lock for new objects.
(Although it might affect the order of SQL statements during commit).
Btw, for new objects you can also use Database.makePersistent(), which
imo makes the intention of inserting a new object clearer.

For objects to update, you definetely should acquire a write lock
before doing any object modifications, because during commit OJB will
compare the state of your object against the state when you acquired
the lock to find out whether the object needs to be updated or not.

HTH,
Gerhard


On Fri, 24 Oct 2003 18:02:21 +0200, "Emmanuel Dupont"
<[EMAIL PROTECTED]> wrote:

>All,
>
> 
>
> 
>
>I'm driving nuts. Is there definitely a position for the lock on ODMG ?
>
> 
>
>I explain, sometimes our updates are done if the lock on an object is done
>before its affectations and sometimes it has to de done after.
>
> 
>
>I 'm really confused. I don't explain that. Our developers don't also.
>
> 
>
>Ex :
>
> 
>
>JdoClient client = new JdoClient();
>
> 
>
>Client.setId(10);
>
>client.setName("Toto");
>
>client.setproduct_FK(12);
>
> 
>
>Tx.lock(client, Write); <===========
>
> 
>
>And sometimes we have to do that :
>
> 
>
>JdoClient client = new JdoClient();
>
> 
>
>Client.setId(10);
>
> 
>
>Tx.lock(client, Write);   <===========
>
> 
>
>client.setName("Toto");
>
>client.setproduct_FK(12);
>
> 
>
>It seems that it is different between an update and a creation.
>
> 
>
>A lock should be before for the update and after for the creation.
>
> 
>
>This is completely weird isn't it ??
>
> 
>
> 
>
>Tell me if it is completely stupid...????
>
> 
>
> 
>
> 
>
> 



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

Reply via email to