JPA / Spring / Delete Entity, type Mismatch (int/long for id)

If you are using Spring Data JPA, the default delete method is:

void delete(T entity); 

Look here: Spring Data JPA Docs

Also, you it's better to use Long than primitive long, because then you can use more methods when validating:

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;

Ok turns out it was just a stupid mistake. So my JPARepository looked like this:

public interface EntityRepository extends JpaRepository<Entity, Integer> {

But Integer represents the type of the Entities ID-Field, which is Long in my case. So i needed to change to ..JpaRepository<Entity, Long>