> How do I correctly implement wrapper? Do I need to override some
> method in some class? Sorry, I'm not yet familiar with JOOQ internals.

You would have to create something like this:

// ------------------------------------
class SelectForUpdate implements Select<Record> {
  private final Select<Record> delegate;

  // ... delegate all methods to "delegate"

  @Override
  public String toSQLReference(Configuration configuration) {
    return delegate.toSQLReference(configuration) + " FOR UPDATE";
  }
}
// ------------------------------------

However, this solution is not really recommended if you're not
familiar with the internals. I'm not going to debug you through those,
You'd have to do that yourself... You'll need some time to get it
right. For now, I'd prefer the plain SQL hack:

// ------------------------------------
create.select().from(MY_TABLE).where(condition).and("1 = 1 FOR UPDATE");
// ------------------------------------

Another option: You could wrap that code in a stored procedure? jOOQ
also generates source code for those.

Reply via email to