theGamblerRises theGamblerRises - 10 months ago 114
Java Question

JOOQ : getNextException call?

I am using JOOQ's

methods. I tried with
methods as well.

Batch batch = create.batchStore(questions);
int[] counts = batch.execute();

Where questions is a list of Generated TableRecords class. I get success while trying to insert data. But I get error while trying to update data.
My query is -

  • How to get JDBC error, since I am getting this exception.

    org.jooq.exception.DataAccessException: SQL [Batch entry 0 insert into query...] was aborted. Call getNextException to see the cause.

    I don't see
    method in JOOQ's DataAccessException. I am unable to catch either BatchUpdateException of SqlException in order to get further details about exception.


jOOQ's DataAccessException is an unchecked wrapper for the JDBC SQLException. If you want to get a hold of those, you can access the SQLException as such:

((SQLException) dataAccessException.getCause()).getNextException();