db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Schulze <Ma...@NightLabs.de>
Subject Re: Update lock?
Date Thu, 31 Jul 2008 16:58:15 GMT
Hello *,

first of all: Sorry for the empty mail to the list: My e-mail client
accidentally sent it in HTML format (even though it didn't have any
formatting) and the mailing list service seems to cut HTML content away.

Well, I've some code where it is essential that objects read from the
datastore are not manipulated by another transaction before they are
modified and written to the datastore. In SQL, you use "SELECT ... FOR
UPDATE" for this purpose, which locks the records included in the query
result just like a write operation does.

Using DataNucleus, I searched on http://www.datanucleus.org for how to
do this in JDO and it seems to me JDO is lacking this feature. Is that
correct? Here's what I found:

1) The page RDBMS persistence
describes the property "datanucleus.rdbms.useUpdateLock" which applies
to all queries. This would leave our code pure-JDO (not
DataNucleus-dependent), but it's unfortunately not what we need: Most of
the time a lock is not required and this option would therefore
unnecessarily slow down our application.

2) The page
shows this code snippet:

        "transaction.serializeReadObjects", "true"

This applies to one transaction and might be very useful, but due to the
cast it would make our code highly dependent on DataNucleus.

3) Additionally, the same page mentions that you can set
"datanucleus.rdbms.query.useUpdateLock" as a JDOQL extension. I assume
that's simply code like this:

    query.addExtension("datanucleus.rdbms.query.useUpdateLock", "true");

Is it planned for the next JDO version to add update-lock-functionality?
IMHO, that's an important feature and should be added to the standard.

Best regards, Marco :-)

*** http://www.jfire.org ***

View raw message