- Q: You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
- A:
- spring.datasource.url=jdbc:MySQL://****:3306/dbname?serverTimezone=UTC
- Q: Table 'dbname.hibernate_sequence' doesn't exist
- A:
主键自增策略有问题 @GeneratedValue(strategy=GenerationType.AUTO) 改成 identity
Hibernate 能够出色地自动生成主键. Hibernate/EBJ 3 注释也可以为主键的自动生成提供丰富的支持, 允许实现各种策略.
其生成规则由 @GeneratedValue 设定的. 这里的 @id 和 @GeneratedValue 都是 JPA 的标准用法, JPA 提供四种标准用法, 由 @GeneratedValue 的源代码可以明显看出.
JPA 提供的四种标准用法为 TABLE,SEQUENCE,IDENTITY,AUTO.
TABLE: 使用一个特定的数据库表格来保存主键.
SEQUENCE: 根据底层数据库的序列来生成主键, 条件是数据库支持序列.
IDENTITY: 主键由数据库自动生成 (主要是自动增长型)
AUTO: 主键由程序控制.
来源: http://www.bubuko.com/infodetail-2958689.html