我有一个使用的实体
@Id @GeneratedValue(strategy = GenerationType.AUTO) private long id;@H_404_3@我有一个这个实体的JPA存储库.现在我想删除其中一个,但标准方法是delete(int i),这是行不通的,因为我的ID不是Integers,而是Longs.所以除了使用int作为我的ID之外,该怎么做?我可以指定一个使用long的自定义删除方法,就像它与findbyXX(XX)一起使用吗?
编辑:
首先:是的我正在使用Data JPA!我想做这个:
jparepository.delete(id);@H_404_3@如果id是整数:
org.hibernate.TypeMismatchException: Provided id of the wrong type for class com.Entity. Expected: class java.lang.Long,got class java.lang.Integer@H_404_3@如果id很长:
no method found for delete(long)@H_404_3@所以我可以将我的ID更改为int,这是我不想做的,或者找到一种让Repository长时间工作的方法.问题是如何