When I try to delete data from my service class using deleteBy() custom method in spring data repository it gives following error.
javax.persistence.TransactionRequiredException: No EntityManager with actual transaction available for current thread - cannot reliably process 'remove' call
I tried with making method and service class @Transactional. Then autowire members get null. Those were initialize without @Transactional.
Load all the data that need to be deleted. getBYId(id); And use that collection to execute deleteAll() operation. That solve the issue.