Thanks a lot for your answer :)
On Friday, May 27, 2016 at 5:11:55 PM UTC+2, Lukas Eder wrote:
>
> Hi Joseph,
>
> Thanks a lot for your feedback, that's very useful to know.
>
> In fact, the jOOQ integration test have exactly what you need. A Java
> agent using javassist that checks if any method on the call stack is
> annotated with @Support, and if that @Support annotation contains the
> allowed dialect(s). We did this for quality assurance, to be sure that
> we’re annotating everything correctly (not just on the “top level”, but
> also deeply nested in jOOQ’s internals). So, when tests are run against
> Oracle, all jOOQ API that is covered by the tests must have any of these
> three:
>
> - No @Support annotation (not SQL relevant)
> - An "empty" @Support annotation (Works with all dialects)
> - A @Support annotation containing the ORACLE dialect
>
> It’s very slow and specific to our use-case, and thus not suitable for
> publishing (yet). But who knows. I haven’t thought of your use-case yet,
> the one of using it to validate which DDL decision to make. Could be useful
> indeed.
>
> For your immediate use-case, you best just use reflection on the
> DSLContext.nextval() method to see if sequences are available in your
> dialect:
>
> Support support = DSLContext.class.getMethod("nextval",
> String.class).getAnnotation(Support.class);
>
>
> Hope this helps,
> Lukas
>
>
> 2016-05-27 14:45 GMT+02:00 <[email protected] <javascript:>>:
>
>> Hello
>>
>> Well, I stumbled upon this message while looking for a way to determine
>> if a feature is supported, at runtime.
>>
>> My need is to create a sequence/always increasing number in a cross
>> database way, dynamically.
>>
>> So I would like know, at runtime, in production, whether the current
>> database supports sequence, and if not defaulting to a manually managed
>> always increasing number.
>>
>> As far as I see it currently I would have to use reflection to go at the
>> @Support annotation's content. Is there any better way?
>>
>> I'm unsure whether if fits with your request for feedback, but still it
>> feels quite close, hence my feedback.
>>
>> Thanks again
>>
>> Best
>> joseph
>>
>>
>> On Monday, May 16, 2016 at 12:22:06 PM UTC+2, Lukas Eder wrote:
>>>
>>> Dear community,
>>>
>>> I've finally implemented what was overdue after I had met Mike Ernst
>>> some years ago at a conference speaker's dinner. The new jOOQ-checker
>>> module. It leverages JSR-308 and the Checker Framework to help users
>>> validate that their Oracle-only DAOs truly work with Oracle, that their
>>> H2/PostgreSQL services really work on both those databases, etc.
>>>
>>> How this works? I've written up a blog post here:
>>>
>>> https://blog.jooq.org/2016/05/09/jsr-308-and-the-checker-framework-add-even-more-typesafety-to-jooq-3-9
>>>
>>> Essentially, you simply annotate your packages / classes / methods with
>>> @Allow and/or @Require annotations, and from then on, those packages /
>>> classes / methods compile only with the allowed and/or required SQLDialects.
>>>
>>> This already works before jOOQ 3.9 will be released in Q3 2016. You can
>>> download and compile the module directly from GitHub and use it with any
>>> jOOQ version:
>>> https://github.com/jOOQ/jOOQ/tree/master/jOOQ-checker
>>>
>>> What I'd love to know *before *releasing jOOQ 3.9 is your early
>>> feedback.
>>>
>>> 1. Is the checker algorithm useful? Or is it too complicated? Or is it
>>> missing things?
>>> 2. Are there any bugs in the checker?
>>> 3. Are there any bugs in the API (e.g. wrong or missing @Support
>>> annotations)
>>> 4. Do you see any other checkers than the PlainSQLChecker and
>>> SQLDialectChecker that could be useful?
>>> 5. Any other feedback?
>>>
>>> Looking forward to your feedback,
>>> Lukas
>>>
>> --
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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/d/optout.