So I run into the 'No EntityManager with actual transaction available' problem, and thanks to that I realized that Spring is executing my SELECT
queries without transactions.
Since some people warn against this practice (see here and here), how do I tell Spring to always use transactions?
EDIT
Judging from the answers that I got so far, I think that my question was not clear enough. So I don't have the 'No EntityManager with actual transaction available' anymore. I fixed that, but when I did have the problem, it was only for persist
and merge
operations, things like find
were working, so that made me realize that Spring is only creating transactions for write operations. What I want now, is to force it to also create transactions for read-only operations.