这个错误是因为eclipse hibernate save数据的时候报错:ids for this class must be manually assigned before calling save()

这种jpatools 自动生成的实体类内没把id 设置为自增,还有id的值在生成的时候默认为string 即使加上了也所以无法自增 ,所以还需要把string 换成Integer   ,因为是自增所以无需送数,把后边的getid  setid 删除掉酒可以

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
//    private String id;
private Integer id;

 

//    public Integer  getId() {
 //       return this.id;
//    }

//    public void setId(String id) {
//        Integer it =Integer.valueOf(id);
//        //int i = it.intValue();  
//        this.id = it;
//    }

 设置自动model时 

hibernate save数据的时候报错:ids for this class must be manually assigned before calling save()

hibernate save数据的时候报错:ids for this class must be manually assigned before calling save()

hibernate save数据的时候报错:ids for this class must be manually assigned before calling save()

 

相关文章:

  • 2022-01-13
  • 2021-11-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-30
猜你喜欢
  • 2021-10-11
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
  • 2021-10-18
相关资源
相似解决方案