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 Alessandro Colantoni <ac...@brujulatelecom.com> on 2004/08/11 16:23:39 UTC

OptimisticLockException

Hi again.
 
I saw that my problem is not in the OSCACHE, but in the locking.
 
I set isolation level = optimistic in the jdbc connection descriptor,
and I put in my table a field with locking=true
 
Every time I do an update on an element of this table I got the
OptmisticLockException.
It looks like the element is never released.
Have I to set any LockManager in the ojb.properies?
I have to put in my code something to release the element?
I tried to remove the cache with 
                          OjbCache cache broker.serviceObjectCache();
                          cASOcacheVO = (CASOVO)cache.lookup(oid)
                          cache.remove(oid).
But it still doesn't work
I tried cahe.clear and still nothing.
What I have to do?
 
Please help me
Thanks 
 
 
 
 
 

Re: OptimisticLockException

Posted by Armin Waibel <ar...@apache.org>.
Hi Alessandro,

Alessandro Colantoni wrote:

> Now I’m doing the design of a booking application for a tour operator.
> I need very high performance because they sell 800.000 travel in an
> year, and they sell 80.000 just the first day they open the booking.
> I absolutely want to use Ojb because restart writing sql queries looks
> like a step back.
> Do you have any suggestion? Do you think it's too much for Ojb?
> 
> I have to use the cache in some particular way?

Please look over the cache docs there you can find the dis-/advantages 
of most ObjectCache implemenations.


> I have to change something in the ojb.properties?

Take care of the PB-pool and the connection-pool settings (here you can 
scale OJB)


> 
> I have some complex transaction, and I don’t Know if use the transaction
> whith an ejb session stateless (I’d put transactional method)
> or use the distributed transaction of odmg.

odmg-api standalone does not support distributed tx. You can embed OJB 
in a JTA (managed) environment, then both api (PB, ODMG) can be used in 
distributed transactions.

regards,
Armin


> (where can’I find
> documentation about it? It is not in your Jakarta page :--)) 
> What do you suggest?
> 
> Thanks a lot.
> 
> -----Mensaje original-----
> De: Armin Waibel [mailto:arminw@apache.org] 
> Enviado el: miércoles, 11 de agosto de 2004 19:02
> Para: OJB Users List
> Asunto: Re: OptimisticLockException
> 
> Brian McCallister wrote:
> 
> 
>>What database are you using?
>>
>>I have hit (and not yet fixed =/) precision difference problems when 
>>dealing with postgres.
>>
> 
> 
> Thought we have fixed this issue by explicit call of #setNanos(0)
> in ClassDescriptor?
> 
> long newCv = (new Date()).getTime();
> Timestamp ts = new Timestamp(newCv);
> ts.setNanos(0);
> f.set(obj, ts);
> 
> Does it only fix an issue with oracle?
> 
> regards,
> Armin
> 
> 
>>-Brian
>>
>>On Aug 11, 2004, at 10:23 AM, Alessandro Colantoni wrote:
>>
>>
>>>Hi again.
>>>
>>>I saw that my problem is not in the OSCACHE, but in the locking.
>>>
>>>I set isolation level = optimistic in the jdbc connection descriptor,
>>>and I put in my table a field with locking=true
>>>
>>>Every time I do an update on an element of this table I got the
>>>OptmisticLockException.
>>>It looks like the element is never released.
>>>Have I to set any LockManager in the ojb.properies?
>>>I have to put in my code something to release the element?
>>>I tried to remove the cache with
>>>                          OjbCache cache broker.serviceObjectCache();
>>>                          cASOcacheVO = (CASOVO)cache.lookup(oid)
>>>                          cache.remove(oid).
>>>But it still doesn't work
>>>I tried cahe.clear and still nothing.
>>>What I have to do?
>>>
>>>Please help me
>>>Thanks
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>---------------------------------------------------------------------
>>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
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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: OptimisticLockException

Posted by Alessandro Colantoni <ac...@brujulatelecom.com>.
Hi Armin and Brian,
Thanks a lot for your interest, but I just solved the problem.
It was in my code. I didn’t put the right value in the ackOptLock field
of my value object before storing it.
I’m sorry but I live in Mallorca, I have to work in August and it’very
hot.
I’m using Ojb since a year and I get the opportunity to tell you that
it’s great.
Now I’m doing the design of a booking application for a tour operator.
I need very high performance because they sell 800.000 travel in an
year, and they sell 80.000 just the first day they open the booking.
I absolutely want to use Ojb because restart writing sql queries looks
like a step back.
Do you have any suggestion? Do you think it's too much for Ojb?

I have to use the cache in some particular way?
I have to change something in the ojb.properties?

I have some complex transaction, and I don’t Know if use the transaction
whith an ejb session stateless (I’d put transactional method)
or use the distributed transaction of odmg. (where can’I find
documentation about it? It is not in your Jakarta page :--)) 
What do you suggest?

Thanks a lot.

-----Mensaje original-----
De: Armin Waibel [mailto:arminw@apache.org] 
Enviado el: miércoles, 11 de agosto de 2004 19:02
Para: OJB Users List
Asunto: Re: OptimisticLockException

Brian McCallister wrote:

> What database are you using?
> 
> I have hit (and not yet fixed =/) precision difference problems when 
> dealing with postgres.
>

Thought we have fixed this issue by explicit call of #setNanos(0)
in ClassDescriptor?

long newCv = (new Date()).getTime();
Timestamp ts = new Timestamp(newCv);
ts.setNanos(0);
f.set(obj, ts);

Does it only fix an issue with oracle?

regards,
Armin

> -Brian
> 
> On Aug 11, 2004, at 10:23 AM, Alessandro Colantoni wrote:
> 
>> Hi again.
>>
>> I saw that my problem is not in the OSCACHE, but in the locking.
>>
>> I set isolation level = optimistic in the jdbc connection descriptor,
>> and I put in my table a field with locking=true
>>
>> Every time I do an update on an element of this table I got the
>> OptmisticLockException.
>> It looks like the element is never released.
>> Have I to set any LockManager in the ojb.properies?
>> I have to put in my code something to release the element?
>> I tried to remove the cache with
>>                           OjbCache cache broker.serviceObjectCache();
>>                           cASOcacheVO = (CASOVO)cache.lookup(oid)
>>                           cache.remove(oid).
>> But it still doesn't work
>> I tried cahe.clear and still nothing.
>> What I have to do?
>>
>> Please help me
>> Thanks
>>
>>
>>
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> 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




---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OptimisticLockException

Posted by Armin Waibel <ar...@apache.org>.
Brian McCallister wrote:

> What database are you using?
> 
> I have hit (and not yet fixed =/) precision difference problems when 
> dealing with postgres.
>

Thought we have fixed this issue by explicit call of #setNanos(0)
in ClassDescriptor?

long newCv = (new Date()).getTime();
Timestamp ts = new Timestamp(newCv);
ts.setNanos(0);
f.set(obj, ts);

Does it only fix an issue with oracle?

regards,
Armin

> -Brian
> 
> On Aug 11, 2004, at 10:23 AM, Alessandro Colantoni wrote:
> 
>> Hi again.
>>
>> I saw that my problem is not in the OSCACHE, but in the locking.
>>
>> I set isolation level = optimistic in the jdbc connection descriptor,
>> and I put in my table a field with locking=true
>>
>> Every time I do an update on an element of this table I got the
>> OptmisticLockException.
>> It looks like the element is never released.
>> Have I to set any LockManager in the ojb.properies?
>> I have to put in my code something to release the element?
>> I tried to remove the cache with
>>                           OjbCache cache broker.serviceObjectCache();
>>                           cASOcacheVO = (CASOVO)cache.lookup(oid)
>>                           cache.remove(oid).
>> But it still doesn't work
>> I tried cahe.clear and still nothing.
>> What I have to do?
>>
>> Please help me
>> Thanks
>>
>>
>>
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> 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: OptimisticLockException

Posted by Brian McCallister <mc...@forthillcompany.com>.
What database are you using?

I have hit (and not yet fixed =/) precision difference problems when 
dealing with postgres.

-Brian

On Aug 11, 2004, at 10:23 AM, Alessandro Colantoni wrote:

> Hi again.
>
> I saw that my problem is not in the OSCACHE, but in the locking.
>
> I set isolation level = optimistic in the jdbc connection descriptor,
> and I put in my table a field with locking=true
>
> Every time I do an update on an element of this table I got the
> OptmisticLockException.
> It looks like the element is never released.
> Have I to set any LockManager in the ojb.properies?
> I have to put in my code something to release the element?
> I tried to remove the cache with
>                           OjbCache cache broker.serviceObjectCache();
>                           cASOcacheVO = (CASOVO)cache.lookup(oid)
>                           cache.remove(oid).
> But it still doesn't work
> I tried cahe.clear and still nothing.
> What I have to do?
>
> Please help me
> Thanks
>
>
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org