List of usage examples for org.springframework.orm.hibernate5 SpringJtaSessionContext SpringJtaSessionContext
public SpringJtaSessionContext(SessionFactoryImplementor factory)
From source file:org.grails.orm.hibernate.GrailsSessionContext.java
public void initJta() { JtaPlatform jtaPlatform = sessionFactory.getServiceRegistry().getService(JtaPlatform.class); TransactionManager transactionManager = jtaPlatform.retrieveTransactionManager(); jtaSessionContext = transactionManager == null ? null : new SpringJtaSessionContext(sessionFactory); }
From source file:org.springframework.orm.hibernate5.SpringSessionContext.java
/** * Create a new SpringSessionContext for the given Hibernate SessionFactory. * @param sessionFactory the SessionFactory to provide current Sessions for *///from ww w. j ava 2s. c o m public SpringSessionContext(SessionFactoryImplementor sessionFactory) { this.sessionFactory = sessionFactory; try { JtaPlatform jtaPlatform = sessionFactory.getServiceRegistry().getService(JtaPlatform.class); this.transactionManager = jtaPlatform.retrieveTransactionManager(); if (this.transactionManager != null) { this.jtaSessionContext = new SpringJtaSessionContext(sessionFactory); } } catch (Exception ex) { LogFactory.getLog(SpringSessionContext.class) .warn("Could not introspect Hibernate JtaPlatform for SpringJtaSessionContext", ex); } }