gpt4 book ai didi

java - hibernate 将 java Long 映射到 MySQL BIGINT 错误

转载 作者:可可西里 更新时间:2023-11-01 06:31:52 25 4
gpt4 key购买 nike

我在 MySQL 中有一个 id 字段类型为 BIGINT 的表

在 hibernate 对象中,我为这个字段使用java Long类型

但是当运行程序时,它抛出异常:预期:类 java.lang.Long,得到类 java.lang.Integer

如何在 hibernate 中映射 MySQL BINGINT 数据类型?

最佳答案

but when run program, it throw exception: Expected: class java.lang.Long, got class java.lang.Integer

Long 用于 BIGINT 是正确的,上述错误表明您以某种方式传递了 Integer,而在某处需要 Long在你的代码中。仔细检查您的代码。

关于java - hibernate 将 java Long 映射到 MySQL BIGINT 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3315941/

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