使用 ARRAY 输出类型从 PostgreSQL 过程生成 JOOQ
JOOQ generation from PostgreSQL procedures using ARRAY out-types
当使用 JOOQ(3.5.1) 生成 java 代码时,如果过程具有 Table return 类型和数组类型字段,我会收到空指针异常。
CREATE OR REPLACE FUNCTION func1(IN param1 integer)
RETURNS TABLE(result1 integer, result2 integer[]) AS
....
生成器错误:
Error while generating table record public.func1
java.lang.NullPointerException
at org.jooq.impl.DefaultDataType.getDataType(DefaultDataType.java:637)
at org.jooq.impl.DefaultDataType.getDataType(DefaultDataType.java:828)
at org.jooq.impl.DefaultDataType.getType(DefaultDataType.java:841)
at org.jooq.util.JavaGenerator.getType(JavaGenerator.java:3220)
at org.jooq.util.JavaGenerator.getType(JavaGenerator.java:3185)
at org.jooq.util.JavaGenerator.getType(JavaGenerator.java:3194)
at org.jooq.util.JavaGenerator.getJavaType(JavaGenerator.java:3173)
at org.jooq.util.JavaGenerator.getJavaType(JavaGenerator.java:3169)
at org.jooq.util.JavaGenerator.getRowType(JavaGenerator.java:935)
at org.jooq.util.JavaGenerator.generateRecord(JavaGenerator.java:700)
at org.jooq.util.JavaGenerator.generateRecord(JavaGenerator.java:659)
at org.jooq.util.JavaGenerator.generateRecords(JavaGenerator.java:648)
at org.jooq.util.JavaGenerator.generate(JavaGenerator.java:309)
at org.jooq.util.JavaGenerator.generate(JavaGenerator.java:247)
at org.jooq.util.GenerationTool.run(GenerationTool.java:402)
at org.jooq.util.GenerationTool.main(GenerationTool.java:167)
at org.jooq.util.GenerationTool$main.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
This is a bug in jOOQ 3.5.1 并将在 jOOQ 3.6.0 和 3.5.2 中修复。
当使用 JOOQ(3.5.1) 生成 java 代码时,如果过程具有 Table return 类型和数组类型字段,我会收到空指针异常。
CREATE OR REPLACE FUNCTION func1(IN param1 integer)
RETURNS TABLE(result1 integer, result2 integer[]) AS
....
生成器错误:
Error while generating table record public.func1
java.lang.NullPointerException
at org.jooq.impl.DefaultDataType.getDataType(DefaultDataType.java:637)
at org.jooq.impl.DefaultDataType.getDataType(DefaultDataType.java:828)
at org.jooq.impl.DefaultDataType.getType(DefaultDataType.java:841)
at org.jooq.util.JavaGenerator.getType(JavaGenerator.java:3220)
at org.jooq.util.JavaGenerator.getType(JavaGenerator.java:3185)
at org.jooq.util.JavaGenerator.getType(JavaGenerator.java:3194)
at org.jooq.util.JavaGenerator.getJavaType(JavaGenerator.java:3173)
at org.jooq.util.JavaGenerator.getJavaType(JavaGenerator.java:3169)
at org.jooq.util.JavaGenerator.getRowType(JavaGenerator.java:935)
at org.jooq.util.JavaGenerator.generateRecord(JavaGenerator.java:700)
at org.jooq.util.JavaGenerator.generateRecord(JavaGenerator.java:659)
at org.jooq.util.JavaGenerator.generateRecords(JavaGenerator.java:648)
at org.jooq.util.JavaGenerator.generate(JavaGenerator.java:309)
at org.jooq.util.JavaGenerator.generate(JavaGenerator.java:247)
at org.jooq.util.GenerationTool.run(GenerationTool.java:402)
at org.jooq.util.GenerationTool.main(GenerationTool.java:167)
at org.jooq.util.GenerationTool$main.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
This is a bug in jOOQ 3.5.1 并将在 jOOQ 3.6.0 和 3.5.2 中修复。