Google app engine EntityNotFoundException:无法检索类型为的实体。。。何时提交

Google app engine EntityNotFoundException:无法检索类型为的实体。。。何时提交,google-app-engine,Google App Engine,当我的servlet试图写一条记录时,它遇到了以下问题 例外情况: javax.persistence.EntityNotFoundException: Could not retrieve entity of kind MyEntity with key MyEntity(1318001) 即使我已经检查并确保id 1318001不存在于 我的数据存储。它发生在我的servlet提交事务时 这是我的代码: EntityManagerFactory emfInstance = P

当我的servlet试图写一条记录时,它遇到了以下问题 例外情况:

javax.persistence.EntityNotFoundException: Could not retrieve entity of  kind MyEntity with key MyEntity(1318001) 
即使我已经检查并确保id 1318001不存在于 我的数据存储。它发生在我的servlet提交事务时

这是我的代码:

EntityManagerFactory emfInstance = 
    Persistence.createEntityManagerFactory("transactions-optional"); 
EntityManager em = emfInstance.createEntityManager(); 
em.getTransaction().begin(); 
MyEntity ent = new MyEntity(....); 
em.persist(ent); 
log.info(ent.toString()); 
em.getTransaction().commit(); 
我可以在日志中看到我的ent,但它导致了提交中的异常 陈述有人能帮忙吗

编辑:@jirungaray@Nicholas,谢谢你的评论。问题没有解决。最后,我在
commit()
中添加了
try
catch
,以监视事件发生的时间。现在我用另一个应用程序替换了这个应用程序,没有遇到同样的问题。如果您仍然感兴趣,这里是实体

@Entity
public class MyEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long key;
    private String tDate;
    private int stkCode;
    private Text tradeRec;

    public MyEntity() {}
    public MyEntity(int code, String dd, Text trec) {
        this.stkCode = code;
        this.tDate = dd;
        this.tradeRec = trec;
    }
    ..... getter and setter skipped

能否请您提供您的实体的来源?如果这仍然是一个问题,请提供您的实体的来源和样本数据,以便我们可以尝试为自己复制。如果不再是问题,请在此处发布您的发现,以便此问题可以被视为已解决。