ConnectionManagerFactoryBean factory = new ConnectionManagerFactoryBean();
factory.setTransactionManager(tm);
factory.setTransaction("xa");
factory.afterPropertiesSet();
ConnectionManager cm = (ConnectionManager) factory.getObject();
ManagedConnectionFactory mcf = new DerbyDataSourceMCF("target/testdb");
dataSource = (DataSource) mcf.createConnectionFactory(cm);
JdbcStoreFactory storeFactory = new JdbcStoreFactory();
storeFactory.setDataSource(dataSource);
storeFactory.setTransactional(true);
store = storeFactory.open("store");