java - Is there a replacement for Isolater (Hibernate 3.6) in Hibernate 4.x and above? -


i have been using isolater (org.hibernate.engine.transaction.isolater) hibernate 3.6 in order able work outside of transaction.

i have upgrade hibernate 4.3 or above , isolater no longer there in version of hibernate. there substitute performing isolated work after change in hibernate?

there replacement in hibernate 4 , 5 seems not intended used outside of hibernate internals.

you need access sessionimplementor you'll have cast session that. can't find way access doesn't involve casting result of getcurrentsession(). can use transactioncoordinator create isolationdelegate works isolater:

    sessionimplementor session = (sessionimplementor) sessionfactory.getcurrentsession();     isolationdelegate isolationdelegate = session.gettransactioncoordinator().createisolationdelegate();     isolationdelegate.delegatework(new abstractwork() {         @override         public void execute(connection connection) throws sqlexception {             // run on separate connection current             // transaction suspended (if necessary)         }     }, false); 

Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -