That does solve the problem nicely. Thanks Lukas!

On Wednesday, 17 August 2016 14:15:37 UTC+2, Lukas Eder wrote:
>
> Hi Jacobo,
>
> Let me try to repeat this with other words, to see if I understood 
> correctly. You have a POJO and want to insert it only if the corresponding 
> primary key does not yet exist. So, you want to do something like:
>
> ctx.insertInto(TABLE)
>
>    .set(ctx.newRecord(TABLE, pojo))
>
>    .onDuplicateKeyIgnore()
>
>    .execute();
>
>
> Does this already solve the problem?
>
> Cheers,
> Lukas
>
> 2016-08-15 13:09 GMT+02:00 Jacobo de Vera <[email protected] 
> <javascript:>>:
>
>> Hi,
>>
>> I'm looking at a piece of code where we go from a generated POJO to a 
>> full insertInto query, where we manually specify all the POJO fields. 
>> This is done so we can do onDuplicateKeyIgnore on it.
>>
>> The pain here is that when adding a new column to that table, one also 
>> has to add it to this query. I quickly set off to replace this with a DAO 
>> usage with the original POJO, but found no way to express the desire to 
>> ignore errors if the key already existed.
>>
>> My question now is whether such mechanism exists or not.
>>
>> Thanks and regards,
>>
>> Jacobo de Vera
>>
>> -- 
>> 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] <javascript:>.
>> 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.

Reply via email to