小编Ale*_*rvu的帖子

Spring数据jpa deleteBy查询不起作用

我正在尝试在我的存储库中创建自定义deleteBy方法查询.似乎hibernate不是删除,而是制作一个select语句.

public interface ContactRepository extends JpaRepository<Contact, Integer> {

    Integer deleteByEmailAddress(String emailAddress);

    //and this one works
    Contact findContactByName(String name);
}
Run Code Online (Sandbox Code Playgroud)

这是Hibernate试图做的事情:

Hibernate:选择contact0_.id为id1_2_,contact0_.emailAddress为> emailAdd2_2_,contact0_.name为name3_2_来自联系人contact0_ where> contact0_.emailAddress =?

我错过了什么?我是否必须进行特殊配置才能使删除工作?

java spring hibernate jpa spring-data-jpa

16
推荐指数
1
解决办法
4万
查看次数

标签 统计

hibernate ×1

java ×1

jpa ×1

spring ×1

spring-data-jpa ×1