Digest for jooq-user@googlegroups.com - 1 update in 1 topic

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Digest for jooq-user@googlegroups.com - 1 update in 1 topic

http://groups.google.com/group/jooq-user/topics mailing list
Sulaiman Malik <[hidden email]>: Sep 14 02:21AM -0700

I am trying to insert the records using batchStore using jooq. I need to
know how we can update the record on unique constraint, currently it is
throwing
an exception that the record already exists
 
SQL Error [23505]: ERROR: duplicate key value violates unique constraint
 
Below is the code
 
DSLContext create = getDSLContext();
List<UserRecord> userRecordList = new ArrayList<>();
for (Users user : model.getUsers()) {
User record = create.newRecord(user);
userRecordList.add(record);
}
create.batchStore(userRecordList).execute();
 
Currently it is inserting the records fine, but when duplicate record found
on the basis of unique constraint it should update the record
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to [hidden email].