I have a cross group transaction in javas jdo application.
It works great on a local application developers server.
However, from unit testing, I get java.lang.IllegalArgumentException: transactions on multiple entity groups only allowed in High Replication applications
.
Can I simulate a highly replicated application using LocalServiceTestHelper?
I am using 1.6.6.
Here is my class, you can run it the way it should play:
public class Ds2Test { private final LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig()); private static final PersistenceManagerFactory pmfXgInstance = JDOHelper.getPersistenceManagerFactory("xg-transactions"); @Before public void setUp() { helper.setUp(); } @After public void tearDown() { helper.tearDown(); } @Test public void testXgTransaction() throws Exception { PersistenceManager xgPm = pmfXgInstance.getPersistenceManager(); Transaction xgTx = xgPm.currentTransaction(); xgTx.begin(); xgTx.commit(); xgPm.close(); } }
And here is the configuration in jdoconfig.xml:
<persistence-manager-factory name="xg-transactions"> <property name="javax.jdo.PersistenceManagerFactoryClass" value="org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"/> <property name="javax.jdo.option.ConnectionURL" value="appengine"/> <property name="javax.jdo.option.NontransactionalRead" value="true"/> <property name="javax.jdo.option.NontransactionalWrite" value="true"/> <property name="javax.jdo.option.RetainValues" value="true"/> <property name="datanucleus.appengine.autoCreateDatastoreTxns" value="true"/> <property name="datanucleus.appengine.datastoreEnableXGTransactions" value="true"/> </persistence-manager-factory>
Exception xgTx.begin();
source share