On Wed, May 6, 2015 at 2:28 PM, Lukas Eder <[email protected]> wrote:
> What exactly do you mean by "not picking them up"? As I've mentioned before,
> table-valued functions are considered to be tables (with parameters), not
> routines, by the code generator. This is why they're listed as:

Sorry, that was my misunderstanding - I had assumed that the changes
you made meant that these {SETOF VOID, SETOF BIGINT} returning
functions would result in a generated class that inherits from
AbstractRoutine.

They are however being correctly detected as table valued functions.

So just put that comment down to my ignorance of the process.

> Is there any reason why you'd need them to be "picked up" as routines,
> explicitly?

The reason for code to be generated for these functions at all is to
be able to call the function and the compile time check of the input
and output parameters. Whether this is achieved as a subclass of
AbstractRoutine or a subclass of TableImpl makes no difference.

As I said before, my question stemmed from my lack of understanding,
not from wanting to do something funky.

So I guess you can use the generated TableImpl artefacts to invoke the
function. That said, I can't seem to find the part of the manual that
relates to the calling convention for this. For example, this example
works and returns the correct result back:

Record result = ctx.select().
                               from(DO_SOMETHING.call(1L)).
                               fetchOne();

But I was also assuming I that the fetchOne() would be typed something like:

Long result = ctx.select(DO_SOMETHING.DO_SOMETHING_).
                           from(DO_SOMETHING).
                           fetchOne().
                           value1();

But the second variant returns an error:

Wrapped by: org.jooq.exception.DataAccessException: SQL [select
"do_something"."do_something" from "public"."do_something"()]; ERROR:
function public.do_something() does not exist
  Hint: No function matches the given name and argument types. You
might need to add explicit type casts.
  Position: 43

Am I doing it wrong?

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