Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'XXX.hibernate_sequence' doesn't exist
如果使用的是msyql数据库,在数据表实体类中,对于自增主键需要设置自增规则为@GeneratedValue(strategy=GenerationType.IDENTITY)
参考文章:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'portal.hibernate_sequence' doesn't exist, 谈谈主键自增的方式
Spring Data JPA踩坑(@id @GeneratedValue)
Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: org.hibernate.TransactionException: JDBC begin transaction failed:
application.yml 数据库连接url中加入 &autoReconnect=true&failOverReadOnly=false
网友评论