Any chance you can post all the code? This way we can just load it up in our
development environment of choice and run it.

On Thu, Feb 4, 2010 at 7:21 PM, aswath satrasala <aswath.satras...@gmail.com
> wrote:

> Any help here...
>
> Thanks.
>
>
> On Wed, Feb 3, 2010 at 5:35 PM, aswath satrasala <
> aswath.satras...@gmail.com> wrote:
>
>> I did further investigation on my unittest (code is pasted in my previous
>> email).
>> The second transaction block is not persisting the SecurityGroup Entity.
>> If I add the following line with in txn block,
>>         securityGroup = pm.getObjectById(SecurityGroup.class,
>> securityGroup.getId());
>>
>> I see the following in testresults file
>> Testcase: testSecurityGroupNotBelongToTenant took 0.239 sec
>>     Caused an ERROR
>> The key value passed to construct a SingleFieldIdentity of type "class
>> javax.jdo.identity.StringIdentity" for class "class
>> com.veersoft.security.SecurityGroup" is null.
>>
>> -Aswath
>>
>>
>> On Wed, Feb 3, 2010 at 12:11 PM, aswath satrasala <
>> aswath.satras...@gmail.com> wrote:
>>
>>> 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<google-appengine-java%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>



-- 
Ikai Lan
Developer Programs Engineer, Google App Engine
http://googleappengine.blogspot.com | http://twitter.com/app_engine

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

Reply via email to