Hi Kevin,

Thanks a lot for your message. While it might make sense to generate 4
overloads for stored procedures with 2 parameters, this quickly gets out of
control as the number of overloads needed for all the possible combinations
is at least O(2^N). It could be more, because in ordinary jOOQ API, there
is an occasional overload that treats T | Field<T> | Select<? extends
Record1<T>> as the same type, which would lead to O(3^N) overloads. As you
can see, this is prohibitive.

The workaround is simple, given that the overloads accepting T are just
convenience for the overloads accepting Field<T>. Just wrap your bind value
explicitly using DSL.val(T):
https://www.jooq.org/doc/latest/manual/sql-building/bind-values

Of course, you can also easily extend the JavaGenerator to add some
additional convenience on your side. Here are some hints on how to do that:
https://www.jooq.org/doc/latest/manual/code-generation/codegen-custom-code

I hope this helps,
Lukas

On Sat, Jan 12, 2019 at 10:44 PM Kevin Embree <[email protected]>
wrote:

> I have a postgres function 'current' that takes 2 values.
>
> The code generator creates the following 2 methods....
>
>     /**
>      * Get <code>khoj.current</code> as a field.
>      */
>     public static Field<Boolean> current(String vNameSpace,
> ValidRangeRecord[] vValidRanges) {
>         Current f = new Current();
>         f.setVNameSpace(vNameSpace);
>         f.setVValidRanges(vValidRanges);
>
>         return f.asField();
>     }
>
>     /**
>      * Get <code>khoj.current</code> as a field.
>      */
>     public static Field<Boolean> current(Field<String> vNameSpace, Field<
> ValidRangeRecord[]> vValidRanges) {
>         Current f = new Current();
>         f.setVNameSpace(vNameSpace);
>         f.setVValidRanges(vValidRanges);
>
>         return f.asField();
>     }
>
>
> But I need one that is a mix, such as ...
>
>     public static Field<Boolean> current(String vNameSpace, Field<
> ValidRangeRecord[]> vValidRanges) {
>         Current f = new Current();
>         f.setVNameSpace(vNameSpace);
>         f.setVValidRanges(vValidRanges);
>
>         return f.asField();
>     }
>
> Is there any way to use the generated code as is? Or do I have to write a
> custom code generator?
>
> --
> 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.
>

-- 
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.

Reply via email to