Hi Akash, Why do you get an exception, and what could jOOQ possibly do about it?
On Fri, Dec 16, 2022 at 12:49 PM akash verma <[email protected]> wrote: > i just want the numbers of rows that inserted successfully as in JDBC we > something like this:- to get the count of updated records. > > try { > // Batch is ready, execute it to insert the data > batchResults = pstmt.executeBatch(); > } catch (BatchUpdateException e) { > System.out.println("Error message: " + e.getMessage()); > batchResults = e.getUpdateCounts(); > } > > here with the help of e.getUpdateCounts iam able to get the counts of > inserted rows. > > but what happen in JOOQ is We get DataAccessException which contains the > cause BatchUpdateException. so here What happen i am not able to use > e.getUpdateCounts(); which is a feature of BatchUpdateException; > > > All i want is If we get some error in batch Insertion/Deletion , still we > can get the number of inserted/deleted records as in JDBC. > On Friday, 16 December 2022 at 17:06:37 UTC+5:30 [email protected] wrote: > >> Akash, >> >> Thanks for your message. I'm guessing you have some constraint violation >> exceptions or something like that? jOOQ's batch API just delegates to JDBC. >> If JDBC doesn't throw any exceptions, then neither can jOOQ. >> >> I might be able to help you a bit further, but you'll have to provide >> more information to see what exactly you're doing. >> >> Best Regards, >> Lukas >> >> On Fri, Dec 16, 2022 at 12:19 PM akash verma <[email protected]> wrote: >> >>> I am facing the error when I try to use batchInsert() method in jooq it >>> does'nt throw error like BatchUpdateException, now I am not able to get the >>> count of the inserted rows in the BatchInsert(). >>> >>> >>> for e.g I have 1000 records to insert with the help of batchInsert() I >>> am able to insert the 990 records but now i am not able to get the count of >>> inserted records as rest 10 records throws the error in this case >>> batchInsert() must return the BatchUpdateException like JDBC so we can get >>> the count of errors records. >>> >>> >>> On Wednesday, 14 December 2022 at 16:27:46 UTC+5:30 akash verma wrote: >>> >>>> Thank you for reply. >>>> >>>> >>>> On Wednesday, 14 December 2022 at 15:13:25 UTC+5:30 [email protected] >>>> wrote: >>>> >>>>> jOOQ calls this a bulk insert, not a batch insert. Just append a >>>>> RETURNING clause and you're all set (if your underlying RDBMS supports >>>>> this, that is): >>>>> >>>>> https://www.jooq.org/doc/latest/manual/sql-building/sql-statements/insert-statement/insert-returning/ >>>>> >>>>> On Wed, Dec 14, 2022 at 10:37 AM akash verma <[email protected]> >>>>> wrote: >>>>> >>>>>> Hey Lukas, >>>>>> >>>>>> I just wanted to know is there any ways to get the generated IDs when >>>>>> we batch insert, does JOOQ provide any methods for the same. >>>>>> >>>>>> I try to use valuesOfRecords() but it is not working. >>>>>> >>>>>> List<Record3<Integer, String, String>> records = ... >>>>>> create.insertInto(AUTHOR, >>>>>> AUTHOR.ID, AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME) >>>>>> .valuesOfRecords(records) >>>>>> .execute(); >>>>>> >>>>>> >>>>>> -- >>>>>> 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]. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/jooq-user/c01ec364-0d1f-4afb-93df-f33a378a8995n%40googlegroups.com >>>>>> <https://groups.google.com/d/msgid/jooq-user/c01ec364-0d1f-4afb-93df-f33a378a8995n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>> -- >>> 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]. >>> >> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/jooq-user/920c77fe-05ce-4cf0-8891-c4c5702ef25bn%40googlegroups.com >>> <https://groups.google.com/d/msgid/jooq-user/920c77fe-05ce-4cf0-8891-c4c5702ef25bn%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > 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]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jooq-user/a15967ad-a9d3-42d2-a7b0-347cc51267d2n%40googlegroups.com > <https://groups.google.com/d/msgid/jooq-user/a15967ad-a9d3-42d2-a7b0-347cc51267d2n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/CAB4ELO7K12%2BvRnyHcSpJj%3D6v_Z-HM-Rb105a779xbSvjQaY7Tw%40mail.gmail.com.
