Search code examples
javahibernatespring-data-jpajpa-criteria

Does Spring Data JPA crudrepository save method have any return value? If so what does it returns?


public void registerCustomer(Customer cust)
{
customerRepo.save(cust);
}

how can i know that my data is insereted successfully in my above code?


Solution

  • Here is from CrudReporsitory.save() javadoc:

    Saves a given entity. Use the returned instance for further operations as the save operation might have changed the entity instance completely.

    It seems like save method returns the saved entity instance.