Hi, Tica.

I have tried your method, but still fail.
In your test, you only get one entity. but i have two.
A entity and B entity, A has a List<B>
I could get A entity or B entity alone.
but I can not get List<B> via A.

I think it is a bug of GAE.
I have a solution for this issue. Use single PersistenceManager in
unit test.
I hope GAE to fix this bug in future.

On Aug 30, 7:27 pm, Tica2 <[email protected]> wrote:
> I have method
> public PersistenceManagerFactory getPersistenceManagerFactory() for
> PersistenceManagerFactory
> insted of private static final PersistenceManagerFactory pmfInstance
> =
> =======
>
> private PersistenceManagerFactory pmf;
>
>         public PersistenceManagerFactory getPersistenceManagerFactory() {
>                 if (pmf == null) {
>                         Properties newProperties = new Properties();
>                         
> newProperties.put("javax.jdo.PersistenceManagerFactoryClass",
>                                         
> "org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory");
>                         newProperties.put("javax.jdo.option.ConnectionURL", 
> "appengine");
>                         
> newProperties.put("javax.jdo.option.NontransactionalRead", "true");
>                         
> newProperties.put("javax.jdo.option.NontransactionalWrite",
> "true");
>                         newProperties.put("javax.jdo.option.RetainValues", 
> "true");
>                         
> newProperties.put("datanucleus.appengine.autoCreateDatastoreTxns",
> "true");
>                         pmf = 
> JDOHelper.getPersistenceManagerFactory(newProperties);
>                 }
>                 return pmf;
>         }
>
> this method is write on LocalDatastoreTestCase class
>
> and test class is like
>
> public class JdoSimpleTestCase extends LocalDatastoreTestCase {
>         public void testSimple() {
>                 PersistenceManagerFactory pmf = 
> getPersistenceManagerFactory();
>                 DataJdo dataJdo = new DataJdo();
>                 dataJdo.setStringVal("tata");
>                 dataJdo.setIntegerVal(1);
>                 PersistenceManager pm = pmf.getPersistenceManager();
>                 try {
>                         System.out.println("Before: " + dataJdo.toString());
>                         pm.makePersistent(dataJdo);
>                         System.out.println("After: " + dataJdo.toString());
>                 } finally {
>                         pm.close();
>                 }
>                 pm = pmf.getPersistenceManager();
>                 dataJdo = (DataJdo) pm.getObjectById(DataJdo.class, 
> dataJdo.getId
> ());
>                 System.out.println("Retrive: " + dataJdo.toString());
>                 pm.close();
>         }
>
>        // more tests
>
> }
>
> these suggestions can help
>
> --
> Petrica Clement Chiriac (Tica2)
> Fluxinternet SRL
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to