gpt4 book ai didi

java - iBATIS - 定义 'javaType' 和 'jdbcType'

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:47:58 25 4
gpt4 key购买 nike

在 iBatis 中定义 resultMap 时,它提供了一个选项来为每个属性设置 javaTypejdbcType 到列映射。

例如

<resultMap id="employee" class="com.mycompany.Employee">
<result property="firstName" column="first_name" javaType="?" jdbcType="?"/>
</resultMap>

想知道我们应该在什么时候定义 javaTypejdbcType我已经看到映射 只是 在不定义这些属性的情况下工作,而在其他情况下我们必须定义它们。

编辑:请参阅下面针对上述问题选择的答案。

此外,我们是否有一个详尽的列表,其中应该定义 javaTypejdbcType

编辑 javaType 应该是众所周知的类型之一,例如java.lang.String, java.util.DatejdbcType 应该来自 java.sql.Types

提前致谢!

最佳答案

对于jdbcType documentation (对于 iBATIS 3)声明:

The JDBC type is only required for nullable columns upon insert, update or delete.

本文档的第 33 页列出了受支持的 JDBC 类型。

对于 javaType 属性,它说:

iBATIS can usually figure out the type if you’re mapping to a JavaBean. However, if you are mapping to a HashMap, then you should specify the javaType explicitly to ensure the desired behaviour.

关于java - iBATIS - 定义 'javaType' 和 'jdbcType',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4907055/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com