Hello Anything wrong here. I have two classes Tenant and SecurityGroup. * Create Tenant * Create SecurityGroup * Add SecurityGroup to Tenant * Persist.
* Create another SecurityGroup entity. * Persist When I query the datastore for SecurityGroup entities, I get back one entity instead of two. Any ideas? Following is the code for the two classes. @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Tenant { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) @Extension(vendorName = "datanucleus", key="gae.encoded-pk", value="true") private String id; @Persistent @Extension(vendorName = "datanucleus", key="gae.pk-name", value="true") private String name; @Persistent private List<SecurityGroup> secGrpList = new ArrayList<SecurityGroup>(); } @PersistenceCapable(identityType = IdentityType.APPLICATION) public class SecurityGroup { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) @Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true") private String id; @Persistent @Extension(vendorName = "datanucleus", key = "gae.pk-name", value = "true") private String name; } Thanks On Thu, Jan 28, 2010 at 5:14 PM, aswath satrasala < aswath.satras...@gmail.com> wrote: > I have the following unittest code. I am persisting two SecurityGroup > entities, one as a child of Tenant and one entity not having any parent. > > beginTxn(); > Tenant tenant = new Tenant(); > SecurityGroup securityGroup = new SecurityGroup(); > securityGroup.setName("PARTYMGRADMIN"); > tenant.getSecGrpList().add(securityGroup); > pm.makePersistent(tenant); > commitTxn(); > > beginTxn(); > securityGroup = new SecurityGroup(); > securityGroup.setName("PARTYMGRADMIN1"); > pm.makePersistent(securityGroup); > commitTxn(); > > beginTxn(); > Query q = pm.newQuery(SecurityGroup.class); > List<SecurityGroup> results = (List<SecurityGroup>) q.execute(); > assertEquals(2, results.size()); > commitTxn(); > > I get results.size() as one. I am expecting the results.size() as two > > -Aswath > -- 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 google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.