private void configureSpringJtaPlatform(Map<String, Object> vendorProperties, JtaTransactionManager jtaTransactionManager) { try { vendorProperties.put(JTA_PLATFORM, new SpringJtaPlatform(jtaTransactionManager)); } catch (LinkageError ex) { // NoClassDefFoundError can happen if Hibernate 4.2 is used and some // containers (e.g. JBoss EAP 6) wraps it in the superclass LinkageError if (!isUsingJndi()) { throw new IllegalStateException("Unable to set Hibernate JTA " + "platform, are you using the correct " + "version of Hibernate?", ex); } // Assume that Hibernate will use JNDI if (logger.isDebugEnabled()) { logger.debug("Unable to set Hibernate JTA platform : " + ex.getMessage()); } } }
@Test public void defaultJtaPlatform() throws Exception { this.context.register(JtaAutoConfiguration.class); setupTestConfiguration(); this.context.refresh(); Map<String, Object> jpaPropertyMap = this.context .getBean(LocalContainerEntityManagerFactoryBean.class) .getJpaPropertyMap(); assertThat(jpaPropertyMap.get("hibernate.transaction.jta.platform")) .isInstanceOf(SpringJtaPlatform.class); }
@Test public void defaultJtaPlatform() throws Exception { this.context.register(JtaProperties.class, JtaAutoConfiguration.class); setupTestConfiguration(); this.context.refresh(); Map<String, Object> jpaPropertyMap = this.context .getBean(LocalContainerEntityManagerFactoryBean.class) .getJpaPropertyMap(); assertThat(jpaPropertyMap.get("hibernate.transaction.jta.platform"), instanceOf(SpringJtaPlatform.class)); }