I'm using the jOOQ code generator to call an query from an Oracle package. One of the parameters of the query is a String array.
The first issue, is that the code generator used Object
as the type of the parameter. The generated documentation tells me to use an explicit Binding
, but doesn't say how or where. I assume I have to configure something on the GenerationTool
. How do I do that?
The second issue, is what actual value to pass. I've tried String[]
and List<String>
, but neither work. Then I ended up writing my own simple class:
public class MyStringArray extends ArrayRecordImpl<String> {
public MyStringArray() {
super(MySchema.MY_SCHEMA, "ARR_STR", SQLDataType.VARCHAR(255));
}
}
This works, but feels like a hack. How do I do it the "nice" way?
CodePudding user response:
The most common reason why this happens for user defined types is because the type is in a different schema than the routine referencing it, or it was excluded explicitly using <excludes>
. In both cases, you can either:
- Do as the hint in the Javadoc suggests, and implement your own binding
- Much better: include the referenced types in your code generation configuration
The generated Javadoc could be improved because jOOQ knows that the type is a user-defined type and that it's missing from generation output. I've created an issue to improve this: https://github.com/jOOQ/jOOQ/issues/12630