2

I'm facing some problems trying to remove an entity from the database. I have an interface to abstract the AppEngine Entity from my business Object. I can easily Insert and Update, but when I try to delete I got the error:

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) ...

I got the interface ...

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

... the implementation ...

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; 
  } 
} 

and the code to remove...

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

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

I don't have any dependent objects I've just created an Company and now I'm trying to delete it. I assumed the mapping is right cause I'm able to INSERT an UPDATE the company. but not REMOVE! Am I doing something wrong??

Ibrahim Arief
  • 8,742
  • 6
  • 34
  • 54
nanndoj
  • 6,580
  • 7
  • 30
  • 42

1 Answers1

0

Solved!

I just updated the version of Google JDO/JPA to 2.0 and it works well!

nanndoj
  • 6,580
  • 7
  • 30
  • 42