You can create a new record from another record or POJO using DSLContext.newRecord(Table, Object): http://www.jooq.org/javadoc/latest/org/jooq/DSLContext.html#newRecord-org.jooq.Table-java.lang.Object-
... and then insert it using Record.insert(): http://www.jooq.org/javadoc/latest/org/jooq/TableRecord.html#insert-- Example: DSLContext ctx = DSL.using(configuration); MyTableRecord record1 = ctx.selectFrom(MY_TABLE).where(MY_TABLE.ID.eq(1)).fetchOne(); MyTableRecord record2 = ctx.newRecord(MY_TABLE, record1); record2.setId(2); record2.setMyValue("ABC"); record2.insert(); The actual code may vary, depending on whether you use a sequence, identity, or auto_increment column for your primary key... Hope this helps, Lukas 2014-12-18 15:30 GMT+01:00 <[email protected]>: > > Hello. > > I have a simple need: > - fetching a line > - duplicate it > - alter some values > - insert that new line > > I'm trying to find a way to duplicate a Record / a generated POJO but I'm > not able to find a copy constructor somewhere. > > Did I miss it? > Otherwise, how would you do such a thing? > > > Adrien. > > -- > 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. > -- 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.
