Daniele Ulrich [http://community.jboss.org/people/daniele.ulrich] created the discussion
"Re: In memory TaskClient without Mina or JMS" To view the discussion, visit: http://community.jboss.org/message/616860#616860 -------------------------------------------------------------- Hi Franklin I had already started to do some changes to the classes that are managing persistence. If you like, you can try if it works this way... You can start the same way as the original version: TaskService taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener()); TaskServiceSession taskSession = taskService.createSession(); If you are in a container managed transaction environment, the persistence should work now within the JTA scope without further effort. In a non managed environment you will have to use UserTransactions and XA Datasources to ensure transactions over multiple databases.There are a lot of implementations available, maybe you try this one http://docs.codehaus.org/display/BTM/Hibernate13 http://docs.codehaus.org/display/BTM/Hibernate13. You will have to manually start transactions TransactionManagerServices.getConfiguration().setResourceConfigurationFilename("./datasources.properties"); userTransaction = TransactionManagerServices.getTransactionManager(); userTransaction.setTransactionTimeout(60); userTransaction.begin(); try { System.out.println("*** DB1 ***"); persistUser(sf1, "user"); listUsers(sf1); System.out.println("*** DB2 ***"); persistUser(sf2, "user"); listUsers(sf2); userTransaction.commit(); } catch (Exception ex) { ex.printStackTrace(); userTransaction.rollback(); } this way you can keep multiple databases transactional.... Drawback: it definitely will have impact to all the other code you have already implemented that is not using JTA. Try it first without changing your own code, but I'm quite sure, you'll have to use the userTransactions in every situation where you want to guarantee transactions over more than one database. I did not have the time to test the patch properly, so please take care! The implementation uses threadLocalStorage and heavily depends on calling the session.dispose() method to perform clean up of the resources of a thread. Make sure it will be called even if an exception occurs ( catch/finally block ). Cheers Daniele -------------------------------------------------------------- Reply to this message by going to Community [http://community.jboss.org/message/616860#616860] Start a new discussion in jBPM at Community [http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
_______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user