hibernate map java Long到MySQL BIGINT错误 [英] hibernate map java Long to MySQL BIGINT error
问题描述
我在MySQL中有一个带有ID字段类型BIGINT的表
在hibernate对象中,我为此字段使用了java Long类型
但是当运行程序时,它抛出异常:
预期:类java.lang.Long,得到类java.lang.Integer
如何在Hibernate中映射MySQL BINGINT数据类型?
但是当运行程序时,它抛出异常:期望:类java.lang.Long,得到类java.lang.Integer
<对于BIGINT使用 Long
是正确的,并且上面的错误表明你以某种方式传递了一个整数
,其中a Long
预计在您的代码中。仔细检查你的代码。
i have a table with id field type BIGINT in MySQL
in hibernate object, i use java Long type for this field
but when run program, it throw exception:
Expected: class java.lang.Long, got class java.lang.Integer
how to map MySQL BINGINT datatype in hibernate ?
but when run program, it throw exception: Expected: class java.lang.Long, got class java.lang.Integer
Using a Long
for a BIGINT is correct and the above error suggests that you are somehow passing an Integer
where a Long
is expected somewhere in your code. Double check your code.
这篇关于hibernate map java Long到MySQL BIGINT错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!