2012-02-21 32 views
2

我正试图从数据库中删除实体时遇到了一些问题。我有一个接口来从我的业务对象中抽象出AppEngine实体。我可以很容易地插入和更新,但是当我尝试删除我得到的错误:删除AppEngine上的实体时出错

java.lang.UnsupportedOperationException: Non-owned relationships are not currently supported at org.datanucleus.store.appengine.DatastoreFKListStoreSpecialization.clearWit houtDelete(DatastoreFKListStoreSpecialization.java: 123) at org.datanucleus.sco.backed.List.clear(List.java:817) at org.datanucleus.store.mapped.mapping.CollectionMapping.preDelete(Collection Mapping.java: 299) at 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(); 

我没有任何依赖对象我刚刚创建了一个公司,现在我试图删除它。我认为映射是正确的,因为我可以插入UPDATE 公司。但不能删除! 我做错了什么?

+0

为什么在v2.0可用时使用该Google JDO/JPA插件的v1.0版本? – DataNucleus 2012-02-22 10:04:54

回答

0

解决!

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