Yes I'm agree with all the comments, but my problem is that I have to read data after saving and I can only see these data after doing a pm.close(). Anyone has a simple project? I'm really lost and I'm losing a lot of time in this!!!!
2010/7/12 boustanihani <[email protected]> > Not the Manager is created once but the ManagerFactory! > Managers should be created and ended each time data-access is needed! > > I think you should call pm.commit() after calling makePersistent() ... > because after that u r sure that your data has been written! > I would be glad to hear your feedback. > > regards > Hani > > On Jul 12, 6:45 am, Ronmell Fuentes <[email protected]> wrote: > > Hi Andres. > > when you build a PersistenceManager, the instance must be done just once > > during the call in your method, class, etc., so, if you want to continue > > with doing more tasks with it, it's ok. just when the call to your > manager > > class is ended then you can delete or end the manager, otherwise you can > > keep using it. Remember the process of building the manager is done just > > once in your whole app, but the instances can be many. > > > > Rgds. > > > > R > > > > 2010/7/11 Andrés Cerezo <[email protected]> > > > > > > > > > > > > > If i want to execute this source code without errors, I have to delete > the > > > first pm.close(); Anyone knows why? > > > > > final Date date = new Date(); > > > EmployeeData employee = new EmployeeData("John", "Doe", date); > > > > > PersistenceManager pm = PMF.get().getPersistenceManager(); > > > > > final Long id = pm.makePersistent(employee).getId(); > > > > > // From a different persistence manager, look up the // > object > > > > > employee = pm.getObjectById(EmployeeData.class, id); > > > assertEquals(employee.getFirstName(), "John"); > > > assertEquals(employee.getLastName(), "Doe"); > > > > > pm.close(); > > > > > pm = PMF.get().getPersistenceManager(); */ > > > > > EmployeeData employee2 = new EmployeeData("John2", "Doe2", > date); > > > > > final Long id2 = pm.makePersistent(employee2).getId(); > > > > > // From a different persistence manager, look up the // > object > > > > > employee2 = pm.getObjectById(EmployeeData.class, id2); > > > assertEquals(employee2.getFirstName(), "John"); > > > assertEquals(employee2.getLastName(), "Doe"); > > > > > pm.close(); > > > > > Thanks. > > > > > -- > > > 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]<google-appengine-java%[email protected]><google-appengine-java%2B > [email protected]> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/google-appengine-java?hl=en. > > > > -- > > ausencia de evidencia ≠ evidencia de ausenciahttp:// > culturainteractiva.blogspot.com/ > > -- > 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]<google-appengine-java%[email protected]> > . > 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 [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.
