You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Bonnie MacKellar <BM...@mobius.com> on 2003/06/04 19:51:01 UTC

optimistic locking question

Forgive me, I know this is a really basic question, but...
I just finished reading how to set up  optimistic locking.
I gather that I need to set this explicitly for each class,
and that each table needs to have a dedicated column
for this purpose (timestamp or integer). Is this correct?
Is there anything written on optimistic locking besides
the info found in
http://db.apache.org/ojb/repository.html#field-descriptor?

thanks,
Bonnie MacKellar
software engineer
Mobius Management Systems, Inc.
bmackell@mobius.com


[FAQ] Re: optimistic locking question

Posted by Thomas Mahler <th...@web.de>.
Hi Bonnie,

Bonnie MacKellar wrote:
> Forgive me, I know this is a really basic question, but...
> I just finished reading how to set up  optimistic locking.
> I gather that I need to set this explicitly for each class,
> and that each table needs to have a dedicated column
> for this purpose (timestamp or integer). Is this correct?

correct.
It's very simple:
1. you need a dedicated column of type INTEGER or TIMESTAMP
2. you need a (possibly private) attribute in your java class 
corresponding to the column.
3. in repository.xml you need a field-descriptor for this attribute.
    this field-descriptor must specify locking="true"

> Is there anything written on optimistic locking besides
> the info found in
> http://db.apache.org/ojb/repository.html#field-descriptor?

Not yet. It's on my to do list.
But it'

> thanks,
> Bonnie MacKellar
> software engineer
> Mobius Management Systems, Inc.
> bmackell@mobius.com
> 
>