You have many alternatives, here are few ones:
- define a service (a class annotated with
@Service
) and annotate with@Transactional
the public method that implements your logic - manage transaction manually through the
EntityManager
injected into your service class constructor - create a custom Repository
Check the Spring docs
CLICK HERE to find out more related problems solutions.