使用ARRAY out-types从PostgreSQL程序生成JOOQ

时间:2015-02-09 13:29:48

标签: postgresql generator jooq

使用JOOQ(3.5.1)生成java代码时我得到Null指针异常,如果procedure有一个带有数组类型字段的Table返回类型。

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)

1 个答案:

答案 0 :(得分:2)

This is a bug in jOOQ 3.5.1并将在jOOQ 3.6.0和3.5.2中修复。