Hi Julian, 2014/1/11 <[email protected]>
> Dear jOOQ mailing list, > > I'm having two problems using jooq which are both related to sequences and > insert statements. I don't know if I'm doing anything wrong so let me try > to describe my problems: > > 1) According to > http://www.jooq.org/doc/3.2/manual/sql-building/column-expressions/sequences-and-serials/, > I'm supposed to use val(...) from org.jooq.impl.DSL if I want to use > sequences in an insert statement. Unfortunately, val is a reserved keyword > in scala so when using scala, I always have to write `val`(...) which is a > bit annoying. Is there an alternative for scala? > DSL.val() and DSL.value() are synonyms. The latter has been introduced for better Scala interoperability, precisely for this reason. > 2) I'm not sure if this is really a jooq issue or if this is an issue at > all :-) I'm using postgresql's serials for my id columns which implicitely > creates an integer column and a sequence. Consequently, jooq generates an > ID field of type Integer and a sequence of type Long which seems to be > correct. > That sounds like a bug to me. Could you provide us with the table's DDL? > On the other hand, when using insertInto(MY_TABLE, MY_TABLE.ID, > ...).values(MY_TABLE_ID_SEQ.nextval(), ...) statements, the types clash > because jooq expects a Field[Integer] but only finds a Field[Long]. One > solution would be to always use bigserials so is this the way to go? > Another solution is to omit the ID field in INSERT statements, as it is auto-generated by PostgreSQL... Cheers Lukas -- 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/groups/opt_out.
