本文介绍了休眠序列不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用 spring 4.2
版本在我的项目中将 hibernate 从 4 升级到 5.这次升级后,我在调用更新方法时,在堆栈跟踪中发现了以下错误.
I tried to upgrade hibernate from 4 to 5 in my project with spring 4.2
version. After this upgrade, I found the following error in my stack trace when I called a method for updating.
10:53:32,185 ERROR TableStructure:149 - could not read a hi value
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'test.hibernate_sequence' doesn't exist
我用注释更改了自动递增的 ID
I changed the auto incremented Id with annotation
@GeneratedValue(strategy=GenerationType.AUTO)
错误仍然存在.
推荐答案
你需要为Hibernate5.x设置false</property>
.. 参见和 链接.
You need to set for Hibernate5.x <property name="hibernate.id.new_generator_mappings">false</property>
.. see and link.
对于旧版本的 hibernate 4.x:<prop key="hibernate.id.new_generator_mappings">false</prop>
For older version of hibernate 4.x:<prop key="hibernate.id.new_generator_mappings">false</prop>
这篇关于休眠序列不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!