3

I am using RecordMapperProvider to convert my join query jooq record to POJO.

Convert.convert(record.getValue("customer_id"), Integer.class);
....

and lot of other fields, As I want to configure it for all the column fields, but for this query I am not fetching it and it throws ArrayIndexOutOfBoundsException: -1

My question is, instead of throwing the exception why don't it just return null ? So that I could just configure it and fetch data whenever I want.

4

1 回答 1

1

异常的性质已在用户组上讨论过 几次。有一个未决问题 #2655来修复此异常并将其替换为更有意义的异常。

我的问题是,为什么不直接返回 null 而不是抛出异常?

这背后的基本原理很容易理解,因为您无法区分:

  • 包含该列但为该列产生的记录null
  • 不包含该列的记录。
于 2013-09-06T07:47:11.650 回答