在AppEngine上删除实体时出错

时间:2012-02-21 09:25:39

标签: java google-app-engine datanucleus

我在尝试从数据库中删除实体时遇到了一些问题。我有一个界面来从我的业务对象中抽象出AppEngine实体。我可以轻松插入和更新,但当我尝试删除时出现错误:

  

java.lang.UnsupportedOperationException:非拥有关系   目前不支持   org.datanucleus.store.appengine.DatastoreFKListStoreSpecialization.clearWit houtDelete(DatastoreFKListStoreSpecialization.java:   123)   在org.datanucleus.sco.backed.List.clear(List.java:817)   在   org.datanucleus.store.mapped.mapping.CollectionMapping.preDelete(Collection Mapping.java:   299)   在   org.datanucleus.store.appengine.DependentDeleteRequest.execute(DependentDel eteRequest.java:   71)   ......

我得到了界面......

public interface ICompany extends IEntityBean { 
  // Getters 
  public List<IUser> getUsers(); 
  public List<IDepartment> getDepartments(); 
  public ICurrency getCurrency() throws Exception; 
} 

......实施......

public class GAECompany extends GAEEntityBean implements ICompany { 
  @Override 
  @OneToMany(mappedBy = "company") 
  public List<IUser> getUsers() { 
    return this.users; 
  } 

  @Override 
  @OneToMany(mappedBy = "company") 
  public List<IDepartment> getDepartments() { 
     return this.departments; 
  } 

  @Transient 
  public ICurrency getCurrency() throws Exception { 
  return this.currency; 
  } 
} 

以及要移除的代码......

  // Get the entity manager 
  EntityManager em = this.getDBManager(); 

  IEntityBean persistent = em.find(obj.getClass(), obj.getId()); 
  em.remove(persistent); 
  em.flush(); 

我没有任何依赖对象,我刚刚创建了一个公司,现在我正在尝试删除它。我认为映射是正确的,因为我能够INSERT一个UPDATE 公司。但没有删除! 难道我做错了什么??

1 个答案:

答案 0 :(得分:0)

解决!

我刚刚将Google JDO / JPA版本更新为2.0,效果很好!