Please see the following code, the IllegalArgumentException should be throwed but not.
// before calling this function, all File entities have already been created. public void ImportData (DataInputStream dis) throws Exception { // this is bug! This line should be put in the for loop. see below. List entityList = new ArrayList (8); int numFiles = dis.readShort (); // about 20 for (int i = 0; i < numFiles; ++ i) { Transaction tx = pm.currentTransaction(); try { tx.begin(); // the beginning line should be here //List entityList = new ArrayList (); String filename = dis.readUTF (); // ... more fields Key fileKey = KeyFactory.createKey (FileInfo.class.getSimpleName(), filename); FileInfo fileInfo = pm.getObjectById(FileInfo.class, fileKey); fileInfo.setFilename(filename); // ... more fields entityList.add (fileInfo); int numRevisions = dis.readInt (); // about 5 for (int j = 0; j < numRevisions; ++ j) { int revisionId = dis.readShort (); // ... more fields Key revisionKey = KeyFactory.createKey (fileKey, revisionId); FileRevision fileRevision = new FileRevision(); fileRevision.setId(revisionKey); fileRevision.setRevisionId(revisionId); // ... more fields entityList.add (fileRevision); } // because the bug mentioned above, entityList.size () // will increase to about 100 in the end. // The strange thing is the following calling will never // throw Exceptions, although apparently // there are many entity groups in the entityList. pm.makePersistentAll (entityList); // using makePersistent instead of makePersistentAll // will also never throw Exceptions. //for (Object entity : entityList) { // pm.makePersistent (entity); //} tx.commit (); } catch (Exception e) { e.printStackTrace(); if (tx.isActive()) { tx.rollback(); } throw e; } } } -- 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.