Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion JOOQ update primary key using .store()
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Lukas Eder  
View profile  
 More options Nov 7 2012, 1:42 pm
From: Lukas Eder <lukas.e...@gmail.com>
Date: Wed, 7 Nov 2012 19:42:47 +0100
Local: Wed, Nov 7 2012 1:42 pm
Subject: Re: JOOQ update primary key using .store()

> You could just throw an exception on PK update.

I'm not so sure about that. The rest of the jOOQ API wouldn't throw
such an exception either. E.g., you could always explicitly update the
PK using Factory.update() or Factory.executeUpdate(), or plain SQL...

> Imagine if the PK has been updated in-between the fetch and store by
> another transaction. Then this could have disastrous behaviour. And it would
> break optimistic locking.

Some databases will create a table lock when you update a primary key.
If not, you should SELECT ... FOR UPDATE such a record, if you intend
to change the primary key.

Anyway, best practices are not relevant for jOOQ (apart from the
Javadoc, maybe), just as they are not relevant for JDBC. "If it's
possible with SQL, it should be possible with jOOQ"...

Cheers
Lukas


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.