Re: EOFetchSpecification that locks objects like 'SELECT FOR UPDATE NO WAIT'
Re: EOFetchSpecification that locks objects like 'SELECT FOR UPDATE NO WAIT'
- Subject: Re: EOFetchSpecification that locks objects like 'SELECT FOR UPDATE NO WAIT'
- From: Chuck Hill <email@hidden>
- Date: Tue, 4 Nov 2008 10:57:55 -0800
On Nov 4, 2008, at 1:41 AM, Andri vonAllmen wrote:
Hi,
a EOFetchSpecification that locks objects and throws an exception on
any other access trials (SELECT, UPDATE, whatever) is required.
Why? This sounds like Pessimistic Locking. EOF is really intended to
be used with Optimistic Locking. What will happen if you make these
locks and the user closes their browser? You can set EOF to use
Pessimistic Locking, but I don't think anyone uses this and you are
likely to find a lot of bugs.
The behaviour should be the same as the SQL Statement 'SELECT FOR
UPDATE NO WAIT'.
For locking objects ('SELECT FOR UPDATE') the EOFetchSpecifications
method 'setRefreshesRefetchedObjects' is used:
EOFetchSpecification spec = new EOFetchSpecification("AnEntity",
qualifier, null);
spec.setRefreshesRefetchedObjects(true);
For the 'NO WAIT' clause, the OracleSQLExpressions
'setUseNoWaitLocks' method seems to be the right one, but i could
not figure out, how to apply it (i'm new to java...and english
speaking -.-).
That class and method are very low level, getting down there is not
going to be easy.
Any helpful hints or examples how to use 'setUseNoWaitLocks' would
be appreciated.
I'd try to find a different way to implement your requirements.
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden