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

前端 未结 3 1909
暗喜
暗喜 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:14

    CrudRepostiroy.save have return type the saved entity

     S save(S entity)
    Saves a given entity. Use the returned instance for further operations as the save operation might have changed the entity instance completely.
    Parameters:
    entity -
    Returns:
    the saved entity
    

提交回复
热议问题