That's very interesting because it works for me:
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Employee {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key id;
private String firstName;
private String lastName;
}
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class A (B) {
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Employee getE() {
return e;
}
public void setE(Employee e) {
this.e = e;
}
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
}
========================
(regardless if transaction is used or not - simply makePersistent
without transaction)
PersistenceManager em = EMF.get().getPersistenceManager();
Employee e = null;
try {
em.currentTransaction().begin();
A a = new A();
e = new Employee();
a.setE(e);
em.makePersistent(a);
em.currentTransaction().commit();
} catch (Exception ee) {
em.currentTransaction().rollback();
}
try {
em.currentTransaction().begin();
B b = new B();
// e = new Employee();
b.setE(e);
em.makePersistent(b);
em.currentTransaction().commit();
} catch (Exception ee) {
em.currentTransaction().rollback();
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" 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-java?hl=en
-~----------~----~----~----~------~----~------~--~---