最近研究了下google的app engine,在删除一个对象时,遇到了如题的异常。在网上找了下,大都是国外的家伙在论坛里讨论。看了好久,终于找到解决方案。

关键就是删除的对象一定是要通过PersistenceManager的getObjectById()方法获取到的。(有谁知道原因的,告诉我一下)

如果还不清楚,看下面的代码:

PersistenceManager manager = Factory.get().getPersistenceManager();
manager.deletePersistent( manager.getObjectById( entity.getClass(),
entity.getId() ) );

本Blog文章除特别声明之外皆为原创文章,欢迎转载,转载请注明: 转载自JSSAY'S BLOG

本文链接地址: http://www.jssay.com/blog/index.php/2010/04/25/transient-instances-cant-be-deleted/


随机日志

标签:

9 条评论


  1. veterinary technician on 05 五 2010

    Great information! I’ve been looking for something like this for a while now. Thanks!

  2. ultrasound technician on 15 五 2010

    Keep posting stuff like this i really like it

  3. bfgsgl on 25 五 2010

    MAmNKa <a href="http://apminrppubuz.com/" rel="nofollow">apminrppubuz</a>, [url=http://wibbkjtcbwxs.com/]wibbkjtcbwxs[/url], [link=http://wdctvkssbuhn.com/]wdctvkssbuhn[/link], http://tqyaqgclzeit.com/

  4. ultrasound technician on 03 六 2010

    Valuable info. Lucky me I found your site by accident, I bookmarked it.

  5. student scholarship on 21 六 2010

    found your site on del.icio.us today and really liked it.. i bookmarked it and will be back to check it out some more later

  6. student scholarship on 23 六 2010

    Valuable info. Lucky me I found your site by accident, I bookmarked it.

  7. Wow this is a great resource.. I’m enjoying it.. good article

  8. Meweneftkep on 30 七 2010

    hello, this my first post. dsfcsvcbyjyui
    <a href="http://google.com" rel="nofollow">cxzc</a>
    http://sdfsd.com

  9. chanel fake handbags on 13 九 2010

    Great articles &amp; Nice a site….


发表评论