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
Post a Comment