Hibernate: select nextval ('hibernate_sequence')
2020-06-08 17:00:37.548 WARN 15244 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 42P01
2020-06-08 17:00:37.549 ERROR 15244 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : 错误: 关系 "hibernate_sequence" 不存在
位置:17
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet
错误原因: 关系 "hibernate_sequence" 不存在,实际是entity类里@GeneratedValue少了strategy
解决办法:添加strategy,如下图
/**
* 商品编号
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "bgi_id")
private Long id;
当然还会有其它的错误原因,欢迎补充。