List of usage examples for org.springframework.transaction.jta JtaTransactionManager afterPropertiesSet
@Override public void afterPropertiesSet() throws TransactionSystemException
From source file:org.wildfly.swarm.examples.camel.jpa.JpaRouteBuilder.java
@Override public void configure() throws Exception { // Configure our JaxbDataFormat to point at our 'model' package JaxbDataFormat jaxbDataFormat = new JaxbDataFormat(); jaxbDataFormat.setContextPath(Customer.class.getPackage().getName()); EntityManagerFactory entityManagerFactory = em.getEntityManagerFactory(); // Configure a JtaTransactionManager by looking up the JBoss transaction manager from JNDI JtaTransactionManager transactionManager = new JtaTransactionManager(userTransaction); transactionManager.afterPropertiesSet(); // Configure the JPA endpoint to use the correct EntityManagerFactory and JtaTransactionManager JpaEndpoint jpaEndpoint = new JpaEndpoint(); jpaEndpoint.setCamelContext(getContext()); jpaEndpoint.setEntityType(Customer.class); jpaEndpoint.setEntityManagerFactory(entityManagerFactory); jpaEndpoint.setTransactionManager(transactionManager); /*/*w w w . j a v a2 s . c o m*/ * Simple route to consume customer record files from directory input/customers, * unmarshall XML file content to a Customer entity and then use the JPA endpoint * to persist the it to the 'ExampleDS' datasource (see standalone.camel.xml for datasource config). */ from("file://{{jboss.server.data.dir}}/customers").unmarshal(jaxbDataFormat).to(jpaEndpoint) .to("log:input?showAll=true"); }
From source file:org.wildfly.camel.examples.jpa.producer.TransactionManagerProducer.java
@Produces @Named("jtaTransactionManager") public PlatformTransactionManager createTransactionManager() { JtaTransactionManager jtaTransactionManager = new JtaTransactionManager(); jtaTransactionManager.setUserTransaction(userTransaction); jtaTransactionManager.afterPropertiesSet(); return jtaTransactionManager; }
From source file:org.wildfly.camel.examples.jpa.JpaRouteBuilder.java
@Override public void configure() throws Exception { // Configure our JaxbDataFormat to point at our 'model' package JaxbDataFormat jaxbDataFormat = new JaxbDataFormat(); jaxbDataFormat.setContextPath(Customer.class.getPackage().getName()); EntityManagerFactory entityManagerFactory = em.getEntityManagerFactory(); // Configure a JtaTransactionManager by looking up the JBoss transaction manager from JNDI JtaTransactionManager transactionManager = new JtaTransactionManager(); transactionManager.setUserTransaction(userTransaction); transactionManager.afterPropertiesSet(); // Configure the JPA endpoint to use the correct EntityManagerFactory and JtaTransactionManager JpaEndpoint jpaEndpoint = new JpaEndpoint(); jpaEndpoint.setCamelContext(getContext()); jpaEndpoint.setEntityType(Customer.class); jpaEndpoint.setEntityManagerFactory(entityManagerFactory); jpaEndpoint.setTransactionManager(transactionManager); /*/*from ww w . j av a 2 s . c o m*/ * Simple route to consume customer record files from directory input/customers, * unmarshall XML file content to a Customer entity and then use the JPA endpoint * to persist the it to the 'ExampleDS' datasource (see standalone.camel.xml for datasource config). */ from("file://{{jboss.server.data.dir}}/customers").unmarshal(jaxbDataFormat).to(jpaEndpoint) .to("log:input?showAll=true"); }