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();
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 | : PENDING,CREATE_COMPLETE,DELETE_IN_PROGRESS,DELETED,DELETE_FAILED |
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();
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
--
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 jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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().toString())
.execute();
You received this message because you are subscribed to a topic in the Google Groups "jOOQ User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jooq-user/K3sT3F5mnM0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jooq-user+...@googlegroups.com.
Thanks for replying... I am not using JOOQ code generator.
However, I am able to insert rows in the DB using SQL workbench which happily accepts String values for enum columns..
...set(field(name("status"), SQLDataType.VARCHAR.asEnumDataType(StatusEnum.class)), request.getStatus())
org.jooq.exception.DataAccessException: SQL [insert into gvsr_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
at org.jooq_3.11.4.POSTGRES.debug(Unknown Source) ~[?:?]
at org.jooq.impl.Tools.translate(Tools.java:2384) ~[jooq-3.11.4.jar:?]
at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:811) ~[jooq-3.11.4.jar:?]
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:364) ~[jooq-3.11.4.jar:?]
at org.jooq.impl.AbstractDelegatingQuery.execute(AbstractDelegatingQuery.java:127) ~[jooq-3.11.4.jar:?]
import org.jooq.EnumType;
public enum State implements EnumType {
PENDING("PENDING"),
IN_PROGRESS("IN_PROGRESS"),
CREATE_COMPLETE("CREATE_COMPLETE"),
DELETE_IN_PROGRESS("DELETE_IN_PROGRESS"),
DELETED("DELETED");
private final String literal;
private State(String literal) {
this.literal = literal;
}
@Override
public String getName() {
return "state";
}
@Override
public String getLiteral() {
return this.literal;
}
}
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 jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/4b5dda5e-6633-4ff6-96bc-a1516f818c0fn%40googlegroups.com.