I just saw two different projects.
In one of them whenever you tried to persist/save an entity from a method with no @Transactional
annotation there was an exception that said: No session found
On the other
Even though no @Transactional
annotation exists the save
method allows saving.
PS - One project uses Spring + Hibernate (with session not found
exception), the other uses Spring + JPA + Spring Data repositories (allows saving with no transactional annotation)
Any ideas why the differences? What's the best practice?
That's because, as the documentation of Spring Data JPA indicates