java - Update record on unique constraint on batch store jooq -


i trying insert records using batchstore using jooq. need know how can update record on unique constraint, throwing exception record exists

sql error [23505]: error: duplicate key value violates unique constraint 

below code

dslcontext create = getdslcontext(); list<userrecord> userrecordlist = new arraylist<>(); (users user : model.getusers()) {     user record = create.newrecord(user);     userrecordlist.add(record); } create.batchstore(userrecordlist).execute(); 

currently inserting records fine, when duplicate record found on basis of unique constraint should update record

i have resolved issue using common interface updatablerecord, first have used fetchone() query record on basis of unique constraint give updatablerecord , set values updated ones added userrecordlist further passed batchstore


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -