ssssteffff
ssssteffff

Reputation: 974

jOOQ generator error (variable already defined) when two functions have same name

EDIT

I noticed that I had two function with the same name, but different parameters / column output, which is legit in SQL (at least PostgreSQL).

jOOQ managed to generate classes for such cases (till 3.8.1 at least), but is not anymore able to do so. I tried deleting one of the two functions and it worked fine. I recreated it, and it failed again.

Is there a parameter or something to get former behavior back?

Thank you

ORIGINAL POST

I've been using jOOQ 3.8.1 and it worked fine. Today, I tried to upgrade to 3.10.2, and the generator does not work anymore, it generates duplicates variables/functions in Table and Record classes for some functions :

My_Function (table) class

/**
 * The column <code>public.my_function.pde_id</code>.
 */
public final TableField<My_FunctionRecord, Long> PDE_ID = createField("pde_id", org.jooq.impl.SQLDataType.BIGINT, this, "");

/**
 * The column <code>public.my_function.pde_id</code>.
 */
public final TableField<My_FunctionRecord, Long> PDE_ID = createField("pde_id", org.jooq.impl.SQLDataType.BIGINT, this, "");

[...same for all fields]

My_FunctionRecord class

/**
 * Setter for <code>public.my_function.pde_id</code>.
 */
public void setPdeId(Long value) {
    set(0, value);
}

/**
 * Getter for <code>public.my_function.pde_id</code>.
 */
public Long getPdeId() {
    return (Long) get(0);
}

/**
 * Setter for <code>public.my_function.pde_id</code>.
 */
public void setPdeId(Long value) {
    set(1, value);
}

/**
 * Getter for <code>public.my_function.pde_id</code>.
 */
public Long getPdeId() {
    return (Long) get(1);
}

[...same for all fields]

public My_FunctionRecord(Long pdeId, Long pdeId, [...same for all fields]) {
    super(My_Function.MY_FUNCTION);

    set(0, pdeId);
    set(1, pdeId);
    [...same for all fields]

}

I tested with 3.9.1 and I get the same result. Is it a known issue ?

There is my jooq generator configuration:

<generator>
  <database>
    <name>${db.jooq}</name>
    <includes>.*</includes>
    <excludes></excludes>
    <inputSchema>public</inputSchema>
  </database>
  <generate>
    <records>true</records>
    <deprecated>false</deprecated>
  </generate>
  <target>
    <packageName>com.generated.jooq</packageName>
    <directory>${project.basedir}/src/main/java</directory>
  </target>
</generator>

Upvotes: 0

Views: 861

Answers (1)

Lukas Eder
Lukas Eder

Reputation: 220987

This is a known issue, which hasn't been fixed as of jOOQ 3.10 yet: https://github.com/jOOQ/jOOQ/issues/4055

Upvotes: 1

Related Questions