mybatis bigint jdbctype
时间: 2023-11-15 12:04:29 浏览: 77
In MyBatis, if you want to map a column of type `BIGINT` in your database to a Java type, you can use the `java.lang.Long` data type.
To specify the JDBC type for the mapping, you can use the `jdbcType` attribute in your MyBatis mapping XML file or annotations. For a `BIGINT` column, the corresponding JDBC type is `BIGINT`. Here's an example:
Using XML:
```xml
<resultMap id="myResultMap" type="com.example.MyEntity">
<id property="id" column="id" jdbcType="BIGINT"/>
<!-- Other mappings -->
</resultMap>
```
Using annotations:
```java
public class MyEntity {
@Id
@Column(name = "id", jdbcType = JdbcType.BIGINT)
private Long id;
// Other fields and getters/setters
}
```
By specifying the `jdbcType` as `BIGINT`, MyBatis will handle the mapping between the `BIGINT` database column and the `Long` Java type.
阅读全文