mysql 主键

id为主键并且还是自动增长得;我用的是mysql数据库 

User user = this.userService.getUser(id);
UserHonest honest = new UserHonest();
honest.setId(5);
honest.setHonest(5);
honest.setType("REG");
honest.setUser(user);
this.userHonestService.addUserHonest(honest);

为什么我每次都要还手动设置主键的值  否则就要抱错误 “ids for this class must be manually assigned before calling save”
我不明白是为什么? 请指教

你可能感兴趣的:(mysql)