gpt4 book ai didi

java - 在 AppEngine 上删除实体时出错

转载 作者:行者123 更新时间:2023-11-29 09:16:03 25 4
gpt4 key购买 nike

我在尝试从数据库中删除实体时遇到了一些问题。我有一个接口(interface)可以从我的业务对象中抽象出 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();

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

最佳答案

解决了!

我刚刚将 Google JDO/JPA 的版本更新到 2.0,它运行良好!

关于java - 在 AppEngine 上删除实体时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9375005/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com