【发布时间】:2019-04-11 20:50:39
【问题描述】:
我想知道是否有一种方法可以覆盖我的一些 JpaRepository 的删除方法,而不必覆盖其余的方法。
目前我有类似的东西
public interface UserRepo extends JpaRepository<User, Long>
{
findUserById(long id);
findUserByEmail(String email);
// etc...
}
我想覆盖CrudRepository 中的delete(T Entity) 方法。为此,我已尝试实现 UserRepo,但随后我必须实现所有 findByX,但还没有真正找到有关如何正确执行此操作的任何信息。
是否有任何注释要添加到 Entity 类中的函数以便在您调用 UserRepo.delete(myUser) 时运行?
提前致谢!
【问题讨论】:
-
请查看以下相关问题:stackoverflow.com/questions/39923434/…
-
不,这不是我想要达到的目标。
标签: spring spring-boot spring-data-jpa spring-data