这个错误是因为eclipse 

这种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时 

 

posted on 2018-07-17 14:47  小石头的一天  阅读(336)  评论(0编辑  收藏  举报