I upgraded JOOQ to version 3.11. And used the following code.

create.insertInto(table("stack_info"))
        .set(field(name("id")), request.getStackId())
        .set(field(name("user_name")), request.getUserName())
        .set(field(name("time_created")), request.getTimeCreated())
        .set(field(name("product")), request.getProduct().toString())
        .set(field(name("label")), request.getLabel())
        .set(field(name("instance_type")), request.getInstanceType())
        .set(field(name("status")), request.getStatus())
        .execute();



I still get the following error:-

Caused by: org.postgresql.util.PSQLException: ERROR: column "status" is of 
type stack_status but expression is of type character varying

  Hint: You will need to rewrite or cast the expression.

  Position: 163


Can someone please help.

Thanks,
Ganesh

On Monday, October 1, 2018 at 8:59:59 PM UTC-7, Ramaseshan Ganesh wrote:
>
> Hi,
>
> I am trying to insert a row into the table using the query below using 
> JOOQ.
>
>
> create.insertInto(
>         table("stack_info"),
>         fieldByName("id"),
>         fieldByName("user_name"),
>         fieldByName("time_created"),
>         fieldByName("product"),
>         fieldByName("label"),
>         fieldByName("instance_type"),
>         fieldByName("status"))
>         .values(
>                 request.getStackId(),
>                 request.getUserName(),
>                 request.getTimeCreated(),
>                 request.getProduct().toString(),
>                 request.getLabel(),
>                 request.getInstanceType(),
>                 request.getStatus().toString()
>         ).execute();
>
>
>
>
> Running the above query, I get the following error.
>
> Caused by: org.jooq.exception.DataAccessException: SQL [insert into 
> stack_info ("id", "user_name", "time_created", "product", "label", 
> "instance_type", "status") values (?, ?, cast(? as timestamp), ?, ?, ?, 
> ?)]; ERROR: column "status" is of type stack_status but expression is of 
> type character varying
>
>   Hint: You will need to rewrite or cast the expression.
>
>   Position: 163
>
>
> stack_status is defined as an ENUM in the DB. It has the following values:-
>
> stack_status : 
> PENDING,CREATE_COMPLETE,DELETE_IN_PROGRESS,DELETED,DELETE_FAILED 
>
> Any pointers, how to fix this ?
> Thanks,
> Ganesh
>

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