社区微信群开通啦,扫一扫抢先加入社区官方微信群
社区微信群
在查询和update都能成功。插入数据失败。
加入一个注解就可以解决问题.@GeneratedValue(strategy = GenerationType.IDENTITY)
@Entity
@DynamicUpdate
@Proxy(lazy = false)
public class ProductCategory {
/*类目id*/
@Id //主键
@GeneratedValue(strategy = GenerationType.IDENTITY) //自增类型
private Integer categoryId;
/*类目的名字*/
private String categoryName;
/*类目的编号*/
private Integer categoryType;
}
关于这个注解的作用,有时间去查阅资料补上。
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!