[appengine-java] Re: Editing records in datastore (using JAVA)
Dear Sushama Khadilkar, I am trying my hand in JDO..I have not thought to using JPA yet On Feb 19, 12:10 pm, Sushama Khadilkar wrote: > If you want to update the record using EntityManager , then just use > em.merge(Object). > This the link to the > Example::http://www.javabeat.net/articles/81-jpa-in-netbeans-61-4.html -- 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.
[appengine-java] Re: Editing records in datastore (using JAVA)
datanucleus, Please can you show me how a setter tell JDO that it is called and JDO need to update it??? I am sorry but i am new to java. (Just for app-engine) On Feb 19, 1:49 pm, datanucleus wrote: > > PS: I have added pm.close(); after pm.makePersistent(u); > > still it does not update the record... > > Why should it ? You have gone and updated fields directly so how does > the object *know* that it has been updated ? Either mark the class > updating the fields as @PersistenceAware, or update via setters -- 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.
[appengine-java] Re: Editing records in datastore (using JAVA)
Dear Alexander Arendar , I have tried it. My listing deleting and adding works fine... Just getting stuck in editing part.. On Feb 19, 1:53 pm, Alexander Arendar wrote: > Hi Manjoor, > > you should also call after all these pm.close() and you'll see the result :) > JDO persist the object really at the moment when you are closing the > persistence manager. > > > > On Fri, Feb 19, 2010 at 7:44 AM, Manjoor wrote: > > Thanks for the reply but it does not work. Have a look at this. > > > I have checked it in debugger, It successfuly fetch desired record. > > but after changing it does not saved. No error :( > > > SMSUser u = pm.getObjectById(SMSUser.class,tu.UserId); > > u.ContractPerson = > > req.getParameter("ContractPerson"); > > u.Company = req.getParameter("Company"); > > u.Address = req.getParameter("Address"); > > u.Phone = req.getParameter("Phone"); > > pm.makePersistent(u); > > > On Feb 19, 12:15 am, Jake wrote: > > > The Google App Engine instructions focus on JDO for the datastore > > > implementation. JDO doesn't have the traditional "update" function. > > > You either modify it and close the persistence manager that returned > > > the object (it knows it changed and updates accordingly) or you just > > > persist the object again with the same ID to overwrite it. > > > > See: > >http://code.google.com/appengine/docs/java/datastore/creatinggettinga... > > > > I believe JPA has an update feature, but if you're new to it I suggest > > > JDO since it has better documentation in GAE. > > > > Jake > > > > On Feb 18, 10:55 am, Manjoor wrote: > > > > > I have been searching for sample java program to add,editand delete > > > > records. I found many example showing how to add and delete records > > > > but not a single about editing. Do anyone have a sample source link to > > > > show how toedita record ???- Hide quoted text - > > > > - Show quoted text - > > > -- > > 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.- Hide quoted > >text - > > - Show quoted text - -- 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.
[appengine-java] Re: Editing records in datastore (using JAVA)
datanucleus, I have created SMSUser class like this @PersistenceCapable(identityType = IdentityType.APPLICATION) public class SMSUser { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) public Key UserId; @Persistent public User sUser; @Persistent public String ContractPerson; @Persistent public String Company; @Persistent public String Address; . What i have changed is, instead of get/set method, i have used public members. Does it make any difference??? On Feb 19, 1:49 pm, datanucleus wrote: > > PS: I have added pm.close(); after pm.makePersistent(u); > > still it does not update the record... > > Why should it ? You have gone and updated fields directly so how does > the object *know* that it has been updated ? Either mark the class > updating the fields as @PersistenceAware, or update via setters -- 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.
Re: [appengine-java] Re: Editing records in datastore (using JAVA)
Hi Manjoor, you should also call after all these pm.close() and you'll see the result :) JDO persist the object really at the moment when you are closing the persistence manager. On Fri, Feb 19, 2010 at 7:44 AM, Manjoor wrote: > Thanks for the reply but it does not work. Have a look at this. > > I have checked it in debugger, It successfuly fetch desired record. > but after changing it does not saved. No error :( > > SMSUser u = pm.getObjectById(SMSUser.class,tu.UserId); >u.ContractPerson = > req.getParameter("ContractPerson"); >u.Company = req.getParameter("Company"); >u.Address = req.getParameter("Address"); >u.Phone = req.getParameter("Phone"); >pm.makePersistent(u); > > > On Feb 19, 12:15 am, Jake wrote: > > The Google App Engine instructions focus on JDO for the datastore > > implementation. JDO doesn't have the traditional "update" function. > > You either modify it and close the persistence manager that returned > > the object (it knows it changed and updates accordingly) or you just > > persist the object again with the same ID to overwrite it. > > > > See: > http://code.google.com/appengine/docs/java/datastore/creatinggettinga... > > > > I believe JPA has an update feature, but if you're new to it I suggest > > JDO since it has better documentation in GAE. > > > > Jake > > > > On Feb 18, 10:55 am, Manjoor wrote: > > > > > > > > > I have been searching for sample java program to add,editand delete > > > records. I found many example showing how to add and delete records > > > but not a single about editing. Do anyone have a sample source link to > > > show how toedita record ???- Hide quoted text - > > > > - Show quoted text - > > -- > 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. > > -- 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.
[appengine-java] Re: Editing records in datastore (using JAVA)
> PS: I have added pm.close(); after pm.makePersistent(u); > still it does not update the record... Why should it ? You have gone and updated fields directly so how does the object *know* that it has been updated ? Either mark the class updating the fields as @PersistenceAware, or update via setters -- 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.
Re: [appengine-java] Re: Editing records in datastore (using JAVA)
If you want to update the record using EntityManager , then just use em.merge(Object). This the link to the Example:: http://www.javabeat.net/articles/81-jpa-in-netbeans-61-4.html -- 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.
[appengine-java] Re: Editing records in datastore (using JAVA)
PS: I have added pm.close(); after pm.makePersistent(u); still it does not update the record... I have read most of the article of app-engine and datastore.. On Feb 19, 10:44 am, Manjoor wrote: > Thanks for the reply but it does not work. Have a look at this. > > I have checked it in debugger, It successfuly fetch desired record. > but after changing it does not saved. No error :( > > SMSUser u = pm.getObjectById(SMSUser.class,tu.UserId); > u.ContractPerson = req.getParameter("ContractPerson"); > u.Company = req.getParameter("Company"); > u.Address = req.getParameter("Address"); > u.Phone = req.getParameter("Phone"); > pm.makePersistent(u); > > On Feb 19, 12:15 am, Jake wrote: > > > > > The Google App Engine instructions focus on JDO for the datastore > > implementation. JDO doesn't have the traditional "update" function. > > You either modify it and close the persistence manager that returned > > the object (it knows it changed and updates accordingly) or you just > > persist the object again with the same ID to overwrite it. > > > See:http://code.google.com/appengine/docs/java/datastore/creatinggettinga... > > > I believe JPA has an update feature, but if you're new to it I suggest > > JDO since it has better documentation in GAE. > > > Jake > > > On Feb 18, 10:55 am, Manjoor wrote: > > > > I have been searching for sample java program to add,editand delete > > > records. I found many example showing how to add and delete records > > > but not a single about editing. Do anyone have a sample source link to > > > show how toedita record ???- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - -- 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.
[appengine-java] Re: Editing records in datastore (using JAVA)
Thanks for the reply but it does not work. Have a look at this. I have checked it in debugger, It successfuly fetch desired record. but after changing it does not saved. No error :( SMSUser u = pm.getObjectById(SMSUser.class,tu.UserId); u.ContractPerson = req.getParameter("ContractPerson"); u.Company = req.getParameter("Company"); u.Address = req.getParameter("Address"); u.Phone = req.getParameter("Phone"); pm.makePersistent(u); On Feb 19, 12:15 am, Jake wrote: > The Google App Engine instructions focus on JDO for the datastore > implementation. JDO doesn't have the traditional "update" function. > You either modify it and close the persistence manager that returned > the object (it knows it changed and updates accordingly) or you just > persist the object again with the same ID to overwrite it. > > See:http://code.google.com/appengine/docs/java/datastore/creatinggettinga... > > I believe JPA has an update feature, but if you're new to it I suggest > JDO since it has better documentation in GAE. > > Jake > > On Feb 18, 10:55 am, Manjoor wrote: > > > > > I have been searching for sample java program to add,editand delete > > records. I found many example showing how to add and delete records > > but not a single about editing. Do anyone have a sample source link to > > show how toedita record ???- Hide quoted text - > > - Show quoted text - -- 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.
[appengine-java] Re: Editing records in datastore (using JAVA)
The Google App Engine instructions focus on JDO for the datastore implementation. JDO doesn't have the traditional "update" function. You either modify it and close the persistence manager that returned the object (it knows it changed and updates accordingly) or you just persist the object again with the same ID to overwrite it. See: http://code.google.com/appengine/docs/java/datastore/creatinggettinganddeletingdata.html#Updating_an_Object I believe JPA has an update feature, but if you're new to it I suggest JDO since it has better documentation in GAE. Jake On Feb 18, 10:55 am, Manjoor wrote: > I have been searching for sample java program to add, edit and delete > records. I found many example showing how to add and delete records > but not a single about editing. Do anyone have a sample source link to > show how to edit a record ??? -- 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.