by
207 11
0
3
1,599
0
Top 1% !
Famous
Specified
Popularity: 15013rd place
This snippet is Public
No tags for this snippet yet.
Architecturex86_64
JVMjre8
OSWindows

Hibernate JPA - Get the transaction isolation level in a readable fashion

Hibernate JPA - Get the transaction isolation level in a readable fashion
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/1390738/Hibernate-JPA---Get-the-transaction-isol?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
Session session = (Session) entityManager.getDelegate(); session.doWork((Connection connection) -> { String result; int til = connection.getTransactionIsolation(); switch (til) { case Connection.TRANSACTION_READ_COMMITTED: result = "TRANSACTION_READ_COMMITTED"; break; case Connection.TRANSACTION_READ_UNCOMMITTED: result = "TRANSACTION_READ_UNCOMMITTED"; break; case Connection.TRANSACTION_REPEATABLE_READ: result = "TRANSACTION_REPEATABLE_READ"; break; case Connection.TRANSACTION_SERIALIZABLE: result = "TRANSACTION_SERIALIZABLE"; break; default: result = "TRANSACTION_NONE"; break; } LOG.info("Current transaction isolation level: " + result); });
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus