Hi folks,
-- I recently started using MyBatis and love it compared to the popular ORMs out there! What a breath of fresh air and I so appreciate the work the contributors have put in! It just took me a long while to debug a TypeHandler that I have written for work in some legacy code. I found the problem affecting me in BaseTypeHandler: @Override public T getResult(ResultSet rs, String columnName) throws SQLException { T result; try { result = getNullableResult(rs, columnName); } catch (Exception e) { throw new ResultMapException("Error attempting to get column '" + columnName + "' from result set. Cause: " + e, e); } if (rs.wasNull()) { return null; } else { return result; } } My TypeHandler DOES trigger rs.wasNull() but also returns a type that it has to get back to the caller. In my mind checking rs.wasNull() is incorrect compared to checking result == null. Just wanted some input on the logic here. I overrode the getResult() method to solve my problem, but it seems to me my use case could be a common situation? - GMK. You received this message because you are subscribed to the Google Groups "mybatis-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/2f533ce7-1fea-4407-99b9-ffa0c39aede2%40googlegroups.com. |
Thanks for the feedback, Graeme ! I agree with you. And we actually removed the wasNull check in 3.5.0. ;) Check the release notes and see if it's possible to upgrade to the latest version 3.5.1. Regards, Iwao On Tue, Jun 11, 2019 at 1:11 AM Graeme Knight <[hidden email]> wrote:
You received this message because you are subscribed to the Google Groups "mybatis-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/CA%2Buep2Te0ArQ3YMji53qb65D0Hiz0kZeS9LCyo32_VRLYiC6gA%40mail.gmail.com. |
Dear Iwao,
-- Many thanks for your reply. That's wonderful news! We just implemented MyBatis but I will notify the team to upgrade (and keep up to date) with the newer versions! Sorry to have been 'past history' here. GMK. On Monday, June 10, 2019 at 1:59:30 PM UTC-4, Iwao AVE! wrote:
You received this message because you are subscribed to the Google Groups "mybatis-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/f1177e1a-5d91-48b9-b43a-f61e12dfbbdc%40googlegroups.com. |
Free forum by Nabble | Edit this page |