Issue
I have a method that calls a stored procedure via an entityManager
instance
ProcedureCall storedProcedureCall = entityManager.unwrap(Session.class).createStoredProcedureCall(StoredProcedures.GET_WEB_APPLICATION_STATE_DATA_AND_UPDATE_USER_STATUS.toString());
This stored procedure retrieves the users preferences and also updates the users status from offline to online at the same time. Could i use @Transactional(readOnly = true)
instead of @Transactional
since the update query isn't done by the data requesting application itself?
Solution
The answer seems to be no. When i use @Transactional(readOnly = true)
on a method that calls a stored procedure which both gets data and writes data i'll get the exception.
java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed
Answered By - Maurice