Exception in thread "main" org.hibernate.exception.GenericJDBCException: Field 'bookname' doesn't have a default value
使用了hibernate的注解,定义了主键了生成策略,但是数据库表没有设置自增
mysql数据库
所以,简单处理即可,即把
@GeneratedValue(strategy=GenerationType.AUTO)
去掉即可
Exception in thread "main" org.hibernate.exception.GenericJDBCException: Field 'bookname' doesn't have a default value
使用了hibernate的注解,定义了主键了生成策略,但是数据库表没有设置自增
mysql数据库
所以,简单处理即可,即把
@GeneratedValue(strategy=GenerationType.AUTO)
去掉即可