-
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
Mybatis should determine javaType
via reflection
#3072
Comments
Hello @uklance , Are you sure the second version works? Mappings between Java type and JDBC type is not 1:1 and is DB/driver dependent, so in general, it is not possible to determine JDBC type from Java type. I already commented on the SO question, but the solution is to set |
I know it works with I can now see that each type handler only implements |
MyBatis cannot assume SQL type in the built-in type handlers. For example, users store |
I'd expect to contribute a custom |
I just did a quick test and specifying Please let me know if you need further help. |
Let's assume I have the following bean / mapper interface.
With the following mapper xml
Oracle will fail if
MyBean.getDate()
orMyBean.getString()
return null.I'm forced to pass the
javaType
in the parameter declaration so that mybatis can pass thejdbcType
to OracleI think that Mybatis should be able to use reflection on
MyBean.getDate()
andMyBean.getString()
to determine thejavaType
of each property. It could then use this information to pass the correctjdbcType
to oracle.The text was updated successfully, but these errors were encountered: