I am trying to learn GAE by writing simple java programs. This is the coding I use to try JPA:
EntityManager em = null; try { em = EMF.get().createEntityManager(); int i = 6; Trade5min t5 = new Trade5min(); t5.setStkCode(i); t5.settDate("2010-07-15"); t5.setTradeRec("this is trec of "+i); em.persist(t5); } finally { em.close(); resp.getWriter().println("TestWrite done"); } It works. I can see the persisted records in datastore, and showed "TestWrite done" on the browser. However, if I add a second persist: EntityManager em = null; try { em = EMF.get().createEntityManager(); int i = 6; Trade5min t5 = new Trade5min(); t5.setStkCode(i); t5.settDate("2010-07-15"); t5.setTradeRec("this is trec of "+i); em.persist(t5); i++; t5 = new Trade5min(); t5.setStkCode(i); t5.settDate("2010-07-15"); t5.setTradeRec("this is trec of "+i); em.persist(t5); } finally { em.close(); resp.getWriter().println("TestWrite done"); } It gives out warning: handleAbandonedTxns: Request completed without committing or rolling back and then PersistenceException: Illegal argument at "em.close()". Anybody know what's wrong with my coding? -- 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.