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 Laran Evans <la...@elevasoft.com> on 2005/08/18 19:20:29 UTC
optimistic locking problems
I'm getting optimistic lock exceptions when saving an object. But, the
exception only comes up occasionally. It happens maybe 3 out of every 4
runs.
The object has 3 lists of objects, all of which are persisted as well.
Before saving the parent object all version numbers are null. After saving
1) the parent object and all elements of two of the collections have a
version number of 1. 2) the elements of the third collection have version
numbers of 2.
Can anyone spot from my simple description any potential optimistic locking
issues?
Many thanks,
- laran
Re: optimistic locking problems (P6Spy question)
Posted by Vamsi Atluri <vk...@yahoo.com>.
Hello all,
Sorry to hijack the thread into a question about P6Spy. The P6Spy document
that Armin pointed out here says that we have to modify the "driver"
parameter in the "jdbc-connection-descriptor" of the repository.xml file.
However, I have a managed environment (WSAD/WAS) wherein I do not specify
the driver in the repository.xml file. More specifically, my connection
descriptor is like this:
<jdbc-connection-descriptor
jcd-alias="OJBDb"
default-connection="true"
platform="Db2"
jdbc-level="1.0"
jndi-datasource-name="jdbc/ojbDataSource"
username="*****"
password="*****"
batch-mode="false"
useAutoCommit="1"
ignoreAutoCommitExceptions="false">
<sequence-manager
className="org.apache.ojb.broker.util.sequence.SequenceManagerNativeImpl">
<attribute attribute-name="grabSize"
attribute-value="1"></attribute>
</sequence-manager>
</jdbc-connection-descriptor>
Since I am using jndi-datasource-name, I didn't have to specify the
driver. How do I use P6Spy in such cases? Do I just add an additional
parameter for driver? Any help is appreciated. Thank you.
Regards,
-Vamsi
> Did you
>
> > check the generated sql statements, e.g. via P6Spy (jar is shipped
> with
> > OJB)?
> > http://db.apache.org/ojb/docu/faq.html#traceProfileSQL
> >
> >
> > regards,
> > Armin
> >
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: optimistic locking problems
Posted by Laran Evans <la...@elevasoft.com>.
The problem turned out to be a sequence which had recently been reset in
an external database.
But, I had forgotten about P6spy. So thanks for that reminder.
- laran
Armin Waibel wrote:
> Hi Laran,
>
> Laran Evans wrote:
>
>> I'm getting optimistic lock exceptions when saving an object. But, the
>> exception only comes up occasionally. It happens maybe 3 out of every 4
>> runs.
>>
>>
>>
>> The object has 3 lists of objects, all of which are persisted as well.
>> Before saving the parent object all version numbers are null. After
>> saving
>> 1) the parent object and all elements of two of the collections have a
>> version number of 1. 2) the elements of the third collection have version
>> numbers of 2.
>>
>
> Maybe OJB does perform the objects of the third collection twice (insert
> + update). Could you post the (pseudo) code of your test case? Did you
> check the generated sql statements, e.g. via P6Spy (jar is shipped with
> OJB)?
> http://db.apache.org/ojb/docu/faq.html#traceProfileSQL
>
>
> regards,
> Armin
>
>>
>>
>> Can anyone spot from my simple description any potential optimistic
>> locking
>> issues?
>>
>>
>>
>> Many thanks,
>>
>> - laran
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: optimistic locking problems
Posted by Armin Waibel <ar...@apache.org>.
Hi Laran,
Laran Evans wrote:
> I'm getting optimistic lock exceptions when saving an object. But, the
> exception only comes up occasionally. It happens maybe 3 out of every 4
> runs.
>
>
>
> The object has 3 lists of objects, all of which are persisted as well.
> Before saving the parent object all version numbers are null. After saving
> 1) the parent object and all elements of two of the collections have a
> version number of 1. 2) the elements of the third collection have version
> numbers of 2.
>
Maybe OJB does perform the objects of the third collection twice (insert
+ update). Could you post the (pseudo) code of your test case? Did you
check the generated sql statements, e.g. via P6Spy (jar is shipped with
OJB)?
http://db.apache.org/ojb/docu/faq.html#traceProfileSQL
regards,
Armin
>
>
> Can anyone spot from my simple description any potential optimistic locking
> issues?
>
>
>
> Many thanks,
>
> - laran
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org