I have a simple test as below public class TestDS extends TestCase{ private final LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig());
@Before public void setUp() { helper.setUp(); } @After public void tearDown() throws Exception{ Thread.sleep(100); helper.tearDown(); } public void testWithoutTransaction() throws Exception{ DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); doTest(ds, null); } public void testWithTransaction() throws Exception{ DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); Transaction txn = ds.beginTransaction(); doTest(ds, txn); txn.commit(); } public void doTest(DatastoreService ds, Transaction txn) throws Exception{ Key parentKey = KeyFactory.createKey("parent", "default"); Entity entity = new Entity("Entity01", parentKey); entity.setProperty("prop01", "Property 01"); Key key = ds.put(txn, entity); Entity entity2 = ds.get(txn, key); System.out.println(entity2.getProperty("prop01")); } } For the test testWithoutTransaction, it run successful. However, the test testWithTransaction, exception EntityNotFoundException is raised at line Entity entity2 = ds.get(txn, key); Why we can not get the entity we just put into datastore within a transaction? Please help. Thanks in advance. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.