Missing CrudRepository#findOne method

后端 未结 5 993
我在风中等你
我在风中等你 2020-12-02 07:00

I am using Spring 5 in my project. Until today there was available method CrudRepository#findOne.

But after downloading latest snapshot it suddenly disappeared! Is t

5条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-02 07:39

    An other way more. Add a @Query. Even if I would prefer to consume the Optional:

    @Repository
    public interface AccountRepository extends JpaRepository {
    
        @Query("select a from AccountEntity a where a.id=?1")
        public AccountEntity findOne(Long id);
    

提交回复
热议问题