MountainClimb / datanucleus-appengine

Automatically exported from code.google.com/p/datanucleus-appengine
0 stars 0 forks source link

owned 1-to-n relationship does not work in super class for update and delete #176

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create a super class with a collection of datastore objects
2. create a subclass and persist it 
3. try to delete or update

What is the expected output? What do you see instead?
error is thrown: Non-owned relationships are not currently supported

What version of the product are you using? On what operating system?
App Engine SDK 1.2.8

Please provide any additional information below.
Only tested using the development server

Original issue reported on code.google.com by Mark.Wue...@gmail.com on 18 Dec 2009 at 11:39

GoogleCodeExporter commented 8 years ago
Could you please share your code that generates the exception?  As it stands 
I'm 
only guessing at what you're doing.  Also, I fixed a few inheritance-related 
bugs in 
SDK 1.3.0 so please try to reproduce the exception with that.  Here's some code 
that 
works for me:

  @PersistenceCapable(identityType = IdentityType.APPLICATION)
  @Inheritance(customStrategy = "complete-table")
  public class A {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    Long id;

    @Persistent
    @Element(dependent = "true")
    List<B> bList = new ArrayList<B>();

    public Long getId() {
      return id;
    }

    public List<B> getBList() {
      return bList;
    }
  }

  @PersistenceCapable(identityType = IdentityType.APPLICATION)
  public class ASub extends A {
  }

  @PersistenceCapable(identityType = IdentityType.APPLICATION)
  public class B {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    Key id;
  }

  public void testReport() {
    ASub a = new ASub();
    a.bList.add(new B());
    beginTxn();
    pm.makePersistent(a);
    commitTxn();
    beginTxn();
    a = pm.getObjectById(ASub.class, a.getId());
    pm.deletePersistent(a);
    commitTxn();
  }

Original comment by max.r...@gmail.com on 25 Dec 2009 at 3:00