1. 程式人生 > 其它 >Error attempting to get column 'xxx' from result set. Cause: java.sql.SQLException: 無法轉換為內部表示,Oracle資料庫查詢時的錯誤解決

Error attempting to get column 'xxx' from result set. Cause: java.sql.SQLException: 無法轉換為內部表示,Oracle資料庫查詢時的錯誤解決

整體報錯日誌詳情:

org.springframework.jdbc.UncategorizedSQLException: Error attempting to get column 'xxx' from result set. Cause: java.sql.SQLException: 無法轉換為內部表示
; uncategorized SQLException; SQL state [99999]; error code [17059]; 無法轉換為內部表示; nested exception is java.sql.SQLException: 無法轉換為內部表示

能夠導致這個問題的錯誤很多,我說下我出現錯誤是因為使用了 LomBok 外掛裡的@Builder 這個註解

第一種解決辦法就是 就這個註解幹掉,物件賦值的時候直接xxx.setXXX 就可以;

第二種解決辦法就是再新增LOMBOK上了這兩個註解@AllArgsConstructor @NoArgsConstructor新增無參和全部引數的構造方法,

簡單的說 mybatis 去查詢的時候要用到無參構造方法,添加了@Builder 這個註解導致沒有了無參構造,導致報錯。

總結,出現問題

解決方案1:實體類上直接幹掉 @Builder 註解

解決方案2:實體類上加上@AllArgsConstructor @NoArgsConstructor註解