标签:int could rac strategy 策略 read native create generated
用test类测试service的save方法时,报错如下:
2018-08-24 21:52:13,506 - could not read a hi value com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table ‘sell.hibernate_sequence‘ doesn‘t exist at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.Util.getInstance(Util.java:408) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
后经过调查,原因是实体类的自增主键写的有问题,
原写法:
@GeneratedValue private Integer categoryId;
现写法:
@GeneratedValue(strategy = GenerationType.IDENTITY) //设置主键生成模式为自增 private Integer categoryId;
加上策略后,问题解决
标签:int could rac strategy 策略 read native create generated
原文地址:https://www.cnblogs.com/motong/p/9532176.html