hi all, i am attempting to unit test my JPA code in a Spring unit test.
i read all the doco about gae unit tests. i have this working in normal hibernate JPA with a specific tx manager. I cant see how the txManager is wired up. however i get the following error javax.persistence.TransactionRequiredException: This operation requires a transaction yet it is not active at org.datanucleus.jpa.EntityManagerImpl.assertIsActive(EntityManagerImpl.java: 846) at org.datanucleus.jpa.EntityManagerImpl.flush(EntityManagerImpl.java: 545) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.orm.jpa.ExtendedEntityManagerCreator $ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java: 365) at $Proxy29.flush(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) the test is simple enuff @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:WEB-INF/entitymanager- context.xml", "classpath:WEB-INF/applicationContext.xml" }) @TestExecutionListeners( { DependencyInjectionTestExecutionListener.class }) @TransactionConfiguration( defaultRollback=false, transactionManager="transactionManager") @Transactional public abstract class MyTestCase { private final LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig()); @PersistenceContext protected EntityManager em; @Test public void findFriendsSimple() { PositionUser user1 = new PositionUser(); user1.setFirstName("john"); user1.setLastName("smith"); user1.setGeohash(Geohash.encode(lat+=0.0001, lon)); em.persist(user1); em.flush(); <----- throws here PositionUser find = em.find(PositionUser.class, user1.getKey()); assertEquals( "john", find.getFirstName()); assertEquals( 2, find.getFriends().size() ); System.out.println("----------running query now"); Query query = em.createNamedQuery(PositionUser.FIND_FRIENDS); query.setParameter("userKey", user1.getKey()); List resultList = query.getResultList(); assertEquals( 2, resultList.size() ); } -- 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.