So,
The hibernate SessionFactory
is available.
Now, on java.sql.Connection
there is a method connection.setTransactionIsolation
.
Now, from sessionFactory you can openSession()
, or getCurrentSession()
From there, we can do:
session.doWork(connection -> { ... connection.setTransactionIsolation ... } )
However, my memory tells me this is already too late.
One actually needs to do connection.setTransactionIsolation
likely before the Session
has even been created.
Is this not true?
Further, setReadOnly
has the same requirements.
Now, to get the connection before the session is created there is this answer:
https://stackoverflow.com/a/29844998/961018
But that requires the datasource
.
So is there anyway one, can get the datasource
from SessionFactory
, so I can create this logic from what I currently have?
EDIT
RESPECTFULLY, DO NOT UTTER THE WORDS S.P.R.I.N.G or A.N.N.O.T.A.T.I.O.N.S.