Hi Julio. Can you clarify what you mean by this statement:

"If i change the code to the mail handler class, it works."

As Andy says, creating a new PersistenceManager isn't very expensive, so I
wouldn't store an instance in a static variable or worry about sharing an
instance with other classes -- just create one when you need it and close it
as soon as you're done. You should, on the other hand, make sure to only
load one PersistenceManagerFactory. I see you're using a static variable,
but you can also use a singleton:

http://code.google.com/appengine/docs/java/datastore/usingjdo.html#Getting_a_PersistenceManager_Instance

Please make sure you're closing your PersistenceManager after every
datastore operation -- I notice that you have commented out a few of your
close() calls in a few places. For what it's worth, this is what a typical
method in my own DAO looks like:

public void storeEvent(Event event) {
  PersistenceManager pm = PMF.get().getPersistenceManager();

  try {
    pm.makePersistence(event);
  } finally {
    pm.close();
  }
}

- Jason

On Fri, Oct 30, 2009 at 4:36 PM, Julio Faerman <[email protected]> wrote:

>
> Here is what the log reads:
>
> 22:29:41,776 DEBUG [DataNucleus.Persistence] - Making object
> persistent : "br.com.ximp.vike.server.model.games.ww.ac...@d4ddfd"
> 22:32:02,701 DEBUG [DataNucleus.Persistence] - ObjectManager
> internalFlush() process started - 1 dirty objects
> 22:32:02,701 DEBUG [DataNucleus.Persistence] - ObjectManager
> internalFlush() process finished
> 22:32:02,702 DEBUG [DataNucleus.Persistence] - Disconnecting
> br.com.ximp.vike.server.model.games.ww.ac...@d4ddfd from StateManager
> [pc=br.com.ximp.vike.server.model.games.ww.ac...@d4ddfd,
> lifecycle=P_NEW]
> 22:32:02,703 DEBUG [DataNucleus.Persistence] - Object Manager
> "org.datanucleus.objectmanageri...@1d4c2ba" closed
>
> But the object (ac...@d4ddfd)  is not persisted on PM close.
>
> On Oct 30, 5:10 pm, datanucleus <[email protected]> wrote:
> > > - No error is logged
> >
> > As I already said, the log would tell you what happens. Sure you may
> > have to set things to DEBUG level, but then you're supposed to be
> > debugging so thats taken as read. As DN docs state very clearly non-tx
> > updates will only be persisted to the datastore by a subsequent
> > update, or pm close. All changes do get to the datastore when you
> > close the PM
> >
>

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