-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to resolve result type when the target property has a getter with different return type #2834
Comments
Yes this will be looked at again later. Keeping eye on things today and if nothing else reported will be reverting the original change and pushing 3.5.13 tonight. |
I'm also impacted but I also suspect that we are doing something wrong anyway... I suppose this come from this change:
In this code:
What would be the cleanest way to support optionals with MyBatis? With a new type handler and using Optional for both? |
@MaximeCheramy This is my opinion about your question...
So I don't recommend either of your options. Instead, the convention I recommend is built around immutable objects: public class Foo {
private Integer elementId;
public Foo(Integer elementId) {
this.elementId = elementId;
}
public Optional<Integer> elementId() {
return Optional.ofNullable(elementId);
}
} I use this convention in virtually every class in MyBatis Dynamic SQL. MyBatis can work with a class like this, and the |
Result mapping java type resolution fails when the target property has different types for writing and reading. mybatis#2834
This should be fixed by #2841 . |
MyBatis version
3.5.12
Database vendor and version
Postgresql 14.7
Test case or example project
I've a test case which is working fine on MyBatis version 3.5.11. When I upgraded to 3.5.12, I got No typehandler found for property exception when my app startup, I've included a minimal test.
Steps to reproduce
Clone this then run the maven test
Expected result
MyBatis able to map the property
Actual result
Failed
The text was updated successfully, but these errors were encountered: