I use the following method to delete a set of objects based on a certain where condition, but in reality the number of removed objects could be lesser than the passed collection. How do I get the actual count of deleted entities
http://docs.spring.io/spring/docs/2.5.x/api/org/springframework/orm/hibernate3/HibernateTemplate.html#deleteAll(java.util.Collection)
You can build a query based on primary keys DELETE FROM ... WHERE id IN (1, 2, 3)
or something similar and then use executeUpdate()
method which returns the number of affected rows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With