Hello, everybody!
I try to achieve simple thing - storing a set of keys.
I have two classes:

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Account {

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key id;

   @Persistent(mappedBy="account")
    List<Label> labels = new ArrayList<Label>();

    @Persistent
    Set<Key> ids = new HashSet<Key>();
}

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

     @Persistent
     private Account account;
}

I created new Account

Account a = new Account();
then added two Labels to Account, then added Label's keys to ids set.
As result I have for ids:
[Account(1)/Label(4), Account(1)/Label(3)]

which looks correct.

Then I called
pm.makePersistent(a),
pm.close();

I created new instance of PersistenceManager and restore Account
object.
I get back two Labels, but their keys (ids set) is empty.
What did I do wrong?

Thank you,
  Andrey






--

You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.


Reply via email to