Java Spring: How to see how many entities/rows are affected by a repository.delete method?
问题 Within my application (that uses Spring Data and extending the CrudRepository ), I am deleting Entities using: repository.delete(Dog); This triggers a Cascade-delete on other tables/entities. (note: Hibernate is my JPA implementation) Is there a way to see how many rows/entities this has deleted from the Database? 回答1: It isn't, not at least at JPA level. If you take a look to the EntityManager class (which means going one step deeper than Spring Data), you'll see its remove method returns