One uses flush() typically at the end of a sequence of operations
where you need
to ensure that your objects are synced with the datastore.  I'll
include a link at the bottom
of this with more information.

Your code uses multiple entities.  If they aren't from the same
ancestor entity (that is if they are
not in the same entity group), then you can use the new ' Cross-Group
Transactions' for at most
5 entity types not of the same group if you're using the HR datastore.

http://code.google.com/appengine/docs/java/datastore/transactions.html

http://www.datanucleus.org/javadocs/core/2.1/index.html?org/datanucleus/jdo/JDOPersistenceManager.html

public void flush()
This method flushes all dirty, new, and deleted instances to the
datastore. It has no effect if a transaction is not active. If a
datastore transaction is active, this method synchronizes the cache
with the datastore and reports any exceptions. If an optimistic
transaction is active, this method obtains a datastore connection and
synchronizes the cache with the datastore using this connection. The
connection obtained by this method is held until the end of the
transaction.
Specified by:
flush in interface javax.jdo.PersistenceManager

On Jan 29, 4:46 pm, John Goche <johngoch...@googlemail.com> wrote:
> On Mon, Jan 30, 2012 at 12:37 AM, Nichole <nichole.k...@gmail.com> wrote:
> > Do you have fields within your persistable entities in Data.store
> > which are persistable?
>
> Yes, all the fields within the persistable entities are also persistent.
>
>
>
> >http://www.datanucleus.org/javadocs/core/2.1/org/datanucleus/store/ex...
>
> > You can try pm.flush() and temporarily add catch (Throwable t)
> > { t.printStackTrace() for more detail
>
> Thanks but where in my code am I supposed to call this pm.flush() call?
>
> Thanks,
>
> JG
>
>
>
>
>
>
>
>
>
> > On Jan 28, 3:52 pm, John Goche <johngoch...@googlemail.com> wrote:
> > > Hello,
>
> > > If anyone knows how to deal with
> > > org.datanucleus.exceptions.NucleusUserException: Object Manager has been
> > > closed
> > > any help would be greatly appreciated. Here is the code which is throwing
> > > the exception:
>
> > >   static void persistStore() {
>
> > >     PersistenceManager pm = PMF.get().getPersistenceManager();
> > >     Transaction tx = pm.currentTransaction();
> > >     try {
> > >       tx.begin();
> > >       pm.makePersistent(Data.store);
> > >       tx.commit();
> > >     } finally {
> > >       if (tx.isActive())
> > >         tx.rollback();
> > >       pm.close();
> > >     }
>
> > >   }
>
> > > I don't see anything wrong with the code. Any ideas?
>
> > > John Goche
>
> > --
> > 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-java@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.

-- 
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-java@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