List of usage examples for org.hibernate.service.spi ServiceBinding getService
public R getService()
From source file:org.codehaus.groovy.grails.orm.hibernate.GrailsSessionContext.java
License:Apache License
protected TransactionManager getJtaTransactionManager(Session session) { SessionFactoryImplementor sessionFactoryImpl = null; if (sessionFactory instanceof SessionFactoryImplementor) { sessionFactoryImpl = ((SessionFactoryImplementor) sessionFactory); } else if (session != null) { SessionFactory internalFactory = session.getSessionFactory(); if (internalFactory instanceof SessionFactoryImplementor) { sessionFactoryImpl = (SessionFactoryImplementor) internalFactory; }//from www . j av a 2 s . c o m } if (sessionFactoryImpl == null) { return null; } ServiceBinding<JtaPlatform> sb = sessionFactory.getServiceRegistry() .locateServiceBinding(JtaPlatform.class); if (sb == null) { return null; } return sb.getService().retrieveTransactionManager(); }