Does Spring JPA throw an error if save function is unsuccessful?

前端 未结 3 1874
暗喜
暗喜 2021-01-18 13:45

I would like to know if and what type of error is thrown by Spring JPA when trying to save an object to a database. The JpaRepository.java says to look at org.springframewor

3条回答
  •  伪装坚强ぢ
    2021-01-18 14:15

    It should throw a org.springframework.orm.jpa.JpaSystemException. Also, CrudRepostiroy.save returns you a new instance of the entity you gave it, if you get one back, that's a good sign that it saved.

提交回复
热议问题