I have an Entity that uses
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
and I have a JPA repository for this object. Now I want to remove one of them, but the standard method for this is delete(int i)that cannot work, because my ID is not an integer, but Longs. Therefore, in addition to using intfor my identifiers, what should I do here? Can I specify a custom delete method that uses long, for example, does it work with findbyXX(XX)?
EDIT: First of all: Yes, I am using Data JPA!
I want to do this:
jparepository.delete(id);
In the case of id, an integer:
org.hibernate.TypeMismatchException: Provided id of the wrong type for class com.Entity. Expected: class java.lang.Long, got class java.lang.Integer
In case id is long:
no method found for delete(long)
So, I can either change my ID to int, which I do not want to do, or find a way to make the repository work for a long time. And the question is how