As a matter of fact, I think that jOOQ should have a new, generally
applicable feature that would allow for adding clauses at arbitrary
positions in a SQL statement. Currently, jOOQ supports Oracle-style hints

    select(A, B, C)
    .hint("/*+ SOME_HINT */")
    .from(...)

And there are also plans of supporting SQL Server style options:
https://github.com/jOOQ/jOOQ/issues/1952

But in fact, what users really want is to be able to insert any clause that
might not (yet) be supported by jOOQ into any statement. E.g.

    select(A, B, C)
    .sql("/*+ SOME_HINT */")
    .from(...)
    .sql("/* just a regular comment */")
    .sql("AND SOME SQL")

This would then allow you to add the required DB2-specific isolation
clauses to your statements

    select(A, B, C)
    .from(...)
    .where(...)
    .sql("WITH UR")
    .fetch();

I have registered #2541 for this:
https://github.com/jOOQ/jOOQ/issues/2541

Cheers
Lukas


2013/6/21 Lukas Eder <[email protected]>

> Hello,
>
> The DB2 isolation-clause is currently not supported in jOOQ. I have
> created a feature request for this:
> https://github.com/jOOQ/jOOQ/issues/2537
>
> I might not be able to integrate such a change any time soon, as I
> currently cannot integration test DB2 extensions on my Windows 8 machine.
>
> Indeed, the most "elegant" solution for you to implement right now would
> be to create an ExecuteListener patching the rendered SQL statement on the
> renderEnd() event.
>
> ExecuteListeners are documented here
> - http://www.jooq.org/doc/3.0/manual/sql-execution/execute-listeners/
> - http://www.jooq.org/javadoc/latest/org/jooq/ExecuteListener.html
>
> You could then hook this ExecuteListener into those Configurations that
> should generate this clause.
>
> Cheers
> Lukas
>
> 2013/6/21 <[email protected]>
>
> DB2 allows the specification of an 'isolation-clause' on the select
>> statement.  Our DBAs has requested us to use this clause on many select
>> statements so that DB2 won't escalate a lock to a table lock.  (These
>> queries are mainly used to select data for some of our reports that we have
>> to generate from a batch job).
>>
>> I haven't figured out how to specify it with jOOQ.
>>
>>
>> Specifically, we have to add ' WITH UR' at the end of the sql statement
>>  (UR = uncommittted read).
>>
>> I am using a SelectQuery object to dynamically build the query.
>>  Obviously I can get the SQL string when the query is build & append it
>> myself; but I was hoping for a more elegant solution.
>>
>> Would creating a custom QueryPart be the way to accomplish what i need?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "jOOQ User Group" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to