question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Helpful error message when using multiple `@AutomapConstructor` with `argNameBasedConstructorAutoMapping` setting

See original GitHub issue

I figured I could use multiple @AutomapConstructor annotations in a class when using argNameBasedConstructorAutoMapping setting. It seems to work pretty well in the dev environment (just lucky) but in real environment Mybatis throws an exception with a message of the form below.

Constructor auto-mapping of ''{1}'' failed because ''{0}'' were not found in the result set Available columns are ''{2}'' and mapUnderscoreToCamelCase is ''{3}''."

This kind of message does not provide enough clues to find the root cause.

I think it’s good to be precise with the error message.

Please check the PR https://github.com/mybatis/mybatis-3/pull/2627. Thank you.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
harawatacommented, Jul 31, 2022

It’s a ‘known issue’ ™️ We decided not to fix it because there may be many existing solutions that rely on the current behavior without realizing it.

1reaction
harawatacommented, Jul 31, 2022

Thank you for the explanation and the PR, @sogoagain !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Index (mybatis 3.5.11 API)
argNameBasedConstructorAutoMapping - Variable in class ... Assign a function for producing a conflict error message when contains value with the same key.
Read more >
mybatis-3 - bytemeta
Helpful error message when using multiple `@AutomapConstructor` with `argNameBasedConstructorAutoMapping` setting. dpawlak-pgs. dpawlak-pgs OPEN.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found