Java – hibernate sequence does not exist
•
Java
I tried to upgrade hibernate from 4 to 5.0 in my project using spring version 4.2 After upgrading, when I call the update method, I find the following error in the stack trace
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
I changed the auto increment ID with a comment
@GeneratedValue(strategy=GenerationType.AUTO)
Still wrong
Solution
You can also put:
@GeneratedValue(strategy = GenerationType.IDENTITY)
Let datebase manage the increment of the primary key:
AUTO_INCREMENT PRIMARY KEY
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码