[appengine-java] count total records when using cursor
let say we use cursor and we fast-forward page. 1-10 11-20 when reached here, one record in 23 is deleted 21-30 on in this case, when cursor is at 21, it will only show 9 record on this page correct? In other words, we cannot use global count (total records) for paging unless we will have to start from page 1 again (1-10) again ? -- 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.
[appengine-java] Re: Error javax.persistence.PersistenceException: Illegal argument
Thanks Didier, but @Parent It is not an annotation of JPA... link: http://www.datanucleus.org/products/accessplatform_1_1/jpa/annotations.html What is what you say that I must place in the code? Regards Lisandro On 27 feb, 04:06, Didier Durand durand.did...@gmail.com wrote: Yes, You can't update 2 entities that are not related by a parent (@Parent) - child relationship in a single transaction else GAE creates them in 2 separate entity groups and then throws an exception because a transaction can't update objects in more than 1 entity group. See parag Entity Groups inhttp://code.google.com/appengine/docs/java/datastore/transactions.html regards didier On Feb 26, 8:49 pm, lisandrodc lisandr...@gmail.com wrote: Hi ! I have an error at update an object: public void agregarGrupoConUsuario(Usuario usuario,Long idGrupo) { EntityTransaction et= em.getTransaction(); try { et.begin(); ControladorGrupoTorneo cGT = new ControladorGrupoTorneo(); GrupoTorneo grTorneo = cGT.devolverGrupoTorneo(idGrupo); usuario.agregarGrupoTorneo(grTorneo); em.merge(usuario); et.commit(); //the exception at commit; System.out.println(persistioUsuarioConGrupo); } finally { The error is: Caused by: java.lang.IllegalArgumentException: can't operate on multiple entity groups in a single transaction. found both Element { type: GrupoTorneo id: 3} and Element { type: Usuario id: 11 } Class Usuario: @Entity public class Usuario { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; private String nombreUsuario; private String nombre; private String apellido; private String telefono; private String password; private String mail; private String imagen; private String ciudad; private String pais; @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.REFRESH, CascadeType.MERGE}) private ListRegFechaUsuario listRegFechaUsuario; @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.REFRESH, CascadeType.MERGE}) private ListGrupoTorneo gruposTorneo; /** Class GrupoTorneo: @Entity public class GrupoTorneo { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; private String nombre; private String descripcion; private Date fechaCreacion; private Long idTorneo; private Long idUsuarioCreador; private String nombreUsuarioCreador; private Long idGrupo; ... ... Solution? Regards -- 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.
[appengine-java] Re: Single session per user
Thanks for the response Didier! I know I can store the session id, but how do I then retrieve the session object by id? I have been looking at ways to access _ah_SESSION entities using the low level datastore api like this: DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); com.google.appengine.api.datastore.Query q = new com.google.appengine.api.datastore.Query(_ah_SESSION); I can set a filter to return a single object matching a key value, but is the session id the key value? This is difficult to test, because it seems the _ah_SESSION entities are not created on the dev server. I have also read that session objects could be stored in the memcache. I have been trying this as well using the following code: MemcacheService ms = MemcacheServiceFactory.getMemcacheService(); ms.get(?); I am again not certain what to use for the key value in the ms.get() call. I know the key is prefixed with _ahs, but I don't know the rest. Is this prefix appended to the session id in some way? This is also difficult to test on the dev server, because the sessions don't seem to be stored in the memcache. Does anyone know the difference in session management on the dev server vs the production server? Thanks, Scott On Feb 27, 2:15 am, Didier Durand durand.did...@gmail.com wrote: Hi, Yes, the simplest way is to store the session id in the datastore. You can get a session id via javax.servlet.http .HttpSession.getId(); regards didier On Feb 26, 7:51 pm, Scott shathaw...@gmail.com wrote: Howdy, I want to only allow my users to have a single session at a time. The act of logging in should invalidate a session that might have been created from another devices as well as sending that device a notice via the channel that the session had ended. I actually had this working on my dev server. I used a singleton to hold a copy of the session object and channel information, and when the user logged in from a different device, I would invalidate and send a message. The problem is that since GAE the production server is distributed, I have no guarantee of the same JVM on each call. Reading through docs and group post, the only possibility I could think of was to retrieve the session object from the datastore or memcache. Is it possible to read the session object from the either of these locations? If so what is the key and object type? Thanks a lot, Scott -- 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.
[appengine-java] Re: Can't integrate my GoogleAppEngine(GAE/J) app with JPA (DataNucleus) !
Hello, I got the same error after copying code from another GAEJ project which I had previously developed. The error is causing by a missing persistence.xml file, in my case, or I suppose it could be caused by mis-naming or a missing persistence-unit declaration in the persistence.xml. The full documentation I used previously and need to review is here, http://code.google.com/appengine/docs/java/datastore/jpa/overview.html, as I'm now getting No meta data errors for my data objects. Since I've used JPA with no problems in other projects, I don't anticipate any now, once I've worked through the initial setup and configuration. Cheers! On Jan 27, 11:35 am, Juan Manuel Amorós 120...@gmail.com wrote: Hi! I'm having problems running a Google App Engine app (GAE/J) trying to integrate with JPA but I can't make it work. I followed the simple steps of google official tutorial (http://code.google.com/appengine/ docs/java/datastore/jpa/overview.html). I setted up the persistence.xml file in the right place, downloaded the JAR from the SDK and added to my project as external JARs (using Eclipse SDK). I'm currently not using Maven so i'm doing it manually. When I run the GAE application the following WARNINGs, ERRORs and Exceptions appear on my Console: --- --- --- Jan 27, 2011 3:47:11 PM com.google.apphosting.utils.jetty.JettyLogger info INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger Jan 27, 2011 3:47:11 PM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml INFO: Successfully processed /home/xxx/project/war/WEB-INF/ appengine-web.xml Jan 27, 2011 3:47:11 PM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml INFO: Successfully processed /home/xxx/project/war/WEB-INF/ web.xml Jan 27, 2011 3:47:28 PM org.datanucleus.plugin.NonManagedPluginRegistry registerExtensions WARNING: Extension Point org.eclipse.core.resources.natures not registered, but plugin org.eclipse.jdt.core defined in file:/ home/xxx/project/war/WEB-INF/lib/core-3.1.1.jar refers to it. Jan 27, 2011 3:47:28 PM org.datanucleus.plugin.NonManagedPluginRegistry registerExtensions WARNING: Extension Point org.eclipse.core.resources.builders not registered, but plugin org.eclipse.jdt.core defined in file:/ home/xxx/project/war/WEB-INF/lib/core-3.1.1.jar refers to it. Jan 27, 2011 3:47:28 PM org.datanucleus.plugin.NonManagedPluginRegistry registerExtensions WARNING: Extension Point org.eclipse.core.resources.markers not registered, but plugin org.eclipse.jdt.core defined in file:/ home/xxx/project/war/WEB-INF/lib/core-3.1.1.jar refers to it. Jan 27, 2011 3:47:28 PM org.datanucleus.plugin.NonManagedPluginRegistry registerExtensions WARNING: Extension Point org.eclipse.core.resources.markers not registered, but plugin org.eclipse.jdt.core defined in file:/ home/xxx/project/war/WEB-INF/lib/core-3.1.1.jar refers to it. Jan 27, 2011 3:47:28 PM org.datanucleus.plugin.NonManagedPluginRegistry registerExtensions [etc...] WARNING: Extension Point org.eclipse.core.runtime.contentTypes not registered, but plugin org.eclipse.jdt.core defined in file:/home/xxx/project/war/WEB-INF/ lib/core-3.1.1.jar refers to it. Jan 27, 2011 3:47:28 PM org.datanucleus.plugin.NonManagedPluginRegistry registerExtensions WARNING: Extension Point org.eclipse.core.runtime.preferences not registered, but plugin org.eclipse.jdt.core defined in file:/home/xxx/project/war/WEB-INF/ lib/core-3.1.1.jar refers to it. Jan 27, 2011 3:47:28 PM org.datanucleus.plugin.NonManagedPluginRegistry registerExtensions WARNING: Extension Point org.eclipse.core.runtime.preferences not registered, but plugin org.eclipse.jdt.core defined in file:/home/xxx/project/war/WEB-INF/ lib/core-3.1.1.jar refers to it. Jan 27, 2011 3:47:28 PM org.datanucleus.plugin.NonManagedPluginRegistry resolveConstraints SEVERE: Bundle org.eclipse.jdt.core requires org.eclipse.core.resources but it cannot be resolved. Jan 27, 2011 3:47:28 PM org.datanucleus.plugin.NonManagedPluginRegistry resolveConstraints SEVERE: Bundle org.eclipse.jdt.core requires org.eclipse.core.runtime but it cannot be resolved. Jan 27, 2011 3:47:28 PM org.datanucleus.plugin.NonManagedPluginRegistry resolveConstraints SEVERE: Bundle org.eclipse.jdt.core requires org.eclipse.text but it cannot be resolved. Jan 27, 2011 3:47:30 PM org.datanucleus.plugin.NonManagedPluginRegistry registerExtensions WARNING: Extension Point org.eclipse.core.resources.natures not registered, but plugin org.eclipse.jdt.core defined in
Re: [appengine-java] count total records when using cursor
There is no cache of query results when you use cursors - or limit/offset. They're just pointers into the real datastore index. If you change the datastore, the results will change. If you want 100% guaranteed unchanging query results in a highly dynamic dataset, cache the results yourself in the memcache. Or send them all to the client and page with javascript. Jeff On Sun, Feb 27, 2011 at 5:43 AM, Luke travalle...@gmail.com wrote: let say we use cursor and we fast-forward page. 1-10 11-20 when reached here, one record in 23 is deleted 21-30 on in this case, when cursor is at 21, it will only show 9 record on this page correct? In other words, we cannot use global count (total records) for paging unless we will have to start from page 1 again (1-10) again ? -- 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.
[appengine-java] Persisting and deleting objects using same PersistanceManager
Hi, I have this test (I am creating object, persist it and trying to remove it) and it is failing on fail(not supposed to get here); line. Is it bug in GAE JDO or JDO is supposed to work in this way? private final LocalServiceTestHelper helper = new LocalServiceTestHelper( new LocalDatastoreServiceTestConfig()); @Before public void setUp() { helper.setUp(); } @After public void tearDown() { helper.tearDown(); } @Test public void testBasicDelete() { 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); newProperties.put(datanucleus.appengine.autoCreateDatastoreTxns, true); PersistenceManagerFactory pmf = JDOHelper .getPersistenceManagerFactory(newProperties); PersistenceManager pm = pmf.getPersistenceManager(); JDOMockBasicObject m = new JDOMockBasicObject(); pm.makePersistent(m); long id = m.getId(); assertTrue(id 0); JDOMockBasicObject k = (JDOMockBasicObject) pm.getObjectById( JDOMockBasicObject.class, id); pm.deletePersistent(k); Query query = pm.newQuery(JDOMockBasicObject.class); query.setFilter(key == k); query.declareParameters(com.google.appengine.api.datastore.Key k); query.deletePersistentAll(k.getKey()); try { JDOMockBasicObject l = (JDOMockBasicObject) pm.getObjectById( JDOMockBasicObject.class, id); fail(not supposed to get here); } catch (JDOObjectNotFoundException e) { } } // Mock class: import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey; import com.google.appengine.api.datastore.Key; @PersistenceCapable public class JDOMockBasicObject { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; public Long getId(){ return key.getId(); } public Key getKey(){ return key; } } -- 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.
Re: [appengine-java] Re: How to get all entity types?
Thanks, dider 2011/2/24 Didier Durand durand.did...@gmail.com Hi, Look at http://code.google.com/appengine/docs/java/datastore/metadataqueries.html: all what you need is there. regards didier On Feb 24, 8:01 am, 王宇辉 yuhui.w...@gmail.com wrote: Hi guys, Is there any way to get all the entity names by code? -- Best regards, Yuhui -- 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. -- Best regards, Yuhui -- 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.
[appengine-java] /_ah/warmup calls
My app (appid: mr-october) is experiencing problems with the /_ah/ warmup calls. Looking thru the logs I can not find a single call to warm up that succeeds. Every warm up call shoes this warning message: 2011-02-25 08:56:37.796 A serious problem was encountered with the process that handled this request, causing it to exit. This is likely to cause a new process to be used for the next request to your application. If you see this message frequently, you should contact the App Engine team. (Error code 203) Why is this happening? What can be done about this? here is a summary of the last 20 warm up calls, everyone of them has the above message: 2011-02-25 08:56:37.803 /_ah/warmup 500 10084ms 0cpu_ms 0kb 2011-02-25 08:56:23.326 /_ah/warmup 500 10109ms 0cpu_ms 0kb 2011-02-25 08:55:26.106 /_ah/warmup 500 10105ms 0cpu_ms 0kb 2011-02-23 09:45:47.521 /_ah/warmup 500 11730ms 0cpu_ms 0kb 2011-02-23 09:45:24.489 /_ah/warmup 500 10403ms 0cpu_ms 0kb 2011-02-23 09:45:13.109 /_ah/warmup 500 10523ms 0cpu_ms 0kb 2011-02-23 09:45:01.611 /_ah/warmup 500 10277ms 0cpu_ms 0kb 2011-02-23 09:44:41.613 /_ah/warmup 500 11452ms 0cpu_ms 0kb 2011-02-23 09:44:29.623 /_ah/warmup 500 10773ms 0cpu_ms 0kb 2011-02-23 09:44:17.551 /_ah/warmup 500 10149ms 0cpu_ms 0kb 2011-02-23 09:44:06.398 /_ah/warmup 500 10373ms 0cpu_ms 0kb 2011-02-23 09:43:55.899 /_ah/warmup 500 10927ms 0cpu_ms 0kb 2011-02-23 09:43:42.672 /_ah/warmup 500 10077ms 0cpu_ms 0kb 2011-02-23 09:43:30.522 /_ah/warmup 500 10866ms 0cpu_ms 0kb 2011-02-23 09:42:35.002 /_ah/warmup 500 11582ms 0cpu_ms 0kb 2011-02-23 09:42:22.388 /_ah/warmup 500 11093ms 0cpu_ms 0kb 2011-02-23 09:42:11.134 /_ah/warmup 500 10899ms 0cpu_ms 0kb 2011-02-23 09:41:59.531 /_ah/warmup 500 13852ms 0cpu_ms 0kb 2011-02-23 09:41:44.830 /_ah/warmup 500 11481ms 0cpu_ms 0kb 2011-02-23 09:41:05.745 /_ah/warmup 500 10792ms 0cpu_ms 0kb Thanks, Cian. -- 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.
[appengine-java] GAE (Java) integration with OAuth (facebook, twitter, etc.)
By searching Google, it's possible to come up with several home-grown solutions for gaining OAuth authentication to specific websites such as Facebook and Twitter. Unfortunately, most these methods are outdated and/or are site-specific. Considering that many of today's online apps seek social api integration, what is the best generic way to get this done? I'm seeking a method or library that works with all OAuth apis. I understand, of course, that once authenticated, every api is unique. However, it's the OAuth session variables that seemingly make it so difficult to integrate with GAE. It really shouldn't be that difficult, as this is a very necessary feature for today's cloud applications. Has anyone found a solution to this problem? -- 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.
[appengine-java] handle 1 not found error
Hi, I'm getting the error: com.google.appengine.api.datastore.DatastoreFailureException: handle 1 not found (the number may vary) I looked up, and I found, that it's related to transactions. And I should get the error, when the too much time passes from the start of the transaction to the commit. (Am I right?) So, my problem is, that .. I'm not using transactions.. Is it normal, to get the error without using transactions? 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 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.
[appengine-java] using GQL to access the Contacts.
Hi, I'm pretty sure you must be able to do this but I cannot find any examples anywhere. I'm am having to manually filter my contacts, I'd like to search/ filter my contacts using a GQL query. I've done it with the isolated storage but cannot workout the the contacts. It this possible? 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 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.
[appengine-java] Can't get .gif image to show in app engine
I must be missing something simple here, I have a static gif file that I have uploaded to my app engine application with Eclipse. When I try to access it, it is not available on the server. The requested URL /images/iLinkProgress.gif was not found on this server.The location is https://myapp.appspot.com/images/iLinkProgress.gif... I have checked that I can open the following OK https://myapp.appspot.com/images/Test.html my appengine.web.xml is as follows ?xml version=1.0 encoding=utf-8? appengine-web-app xmlns=http://appengine.google.com/ns/1.0; applicationilinkengine/application version1/version !-- Configure serving/caching of GWT files -- static-files include path=** / !-- The following line requires App Engine 1.3.2 SDK -- include path=**.nocache.* expiration=0s / include path=**.cache.* expiration=365d / exclude path=**.gwt.rpc / /static-files !-- Configure java.util.logging -- system-properties property name=java.util.logging.config.file value=WEB-INF/logging.properties/ /system-properties /appengine-web-app Any help is appreciated on this one. -- 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.
[appengine-java] Re: handle 1 not found error
Hi, I rather had such messages when using task queues and doing mistakes with them. Do you use task queues (or cron jobs) ? regards didier On Feb 27, 5:56 am, JaySicks jaysi...@gmail.com wrote: Hi, I'm getting the error: com.google.appengine.api.datastore.DatastoreFailureException: handle 1 not found (the number may vary) I looked up, and I found, that it's related to transactions. And I should get the error, when the too much time passes from the start of the transaction to the commit. (Am I right?) So, my problem is, that .. I'm not using transactions.. Is it normal, to get the error without using transactions? 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 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.
[appengine-java] Re: Can't get .gif image to show in app engine
Hi, Did you try specifically include path=/images/*.gif / in your config file ? If I were you, I would. didier On Feb 28, 6:15 am, i3k paulncornw...@gmail.com wrote: I must be missing something simple here, I have a static gif file that I have uploaded to my app engine application with Eclipse. When I try to access it, it is not available on the server. The requested URL /images/iLinkProgress.gif was not found on this server.The location ishttps://myapp.appspot.com/images/iLinkProgress.gif... I have checked that I can open the following OK https://myapp.appspot.com/images/Test.html my appengine.web.xml is as follows ?xml version=1.0 encoding=utf-8? appengine-web-app xmlns=http://appengine.google.com/ns/1.0; applicationilinkengine/application version1/version !-- Configure serving/caching of GWT files -- static-files include path=** / !-- The following line requires App Engine 1.3.2 SDK -- include path=**.nocache.* expiration=0s / include path=**.cache.* expiration=365d / exclude path=**.gwt.rpc / /static-files !-- Configure java.util.logging -- system-properties property name=java.util.logging.config.file value=WEB-INF/logging.properties/ /system-properties /appengine-web-app Any help is appreciated on this one. -- 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.
[appengine-java] Re: Error javax.persistence.PersistenceException: Illegal argument
Sorry, Got confused with Objectify that I use now in place of JDO/JPA. Look at this blog: http://gae-java-persistence.blogspot.com/ You have there the needed examples to solve your problem regards didier On Feb 27, 2:53 pm, lisandrodc lisandr...@gmail.com wrote: Thanks Didier, but @Parent It is not an annotation of JPA... link:http://www.datanucleus.org/products/accessplatform_1_1/jpa/annotation... What is what you say that I must place in the code? Regards Lisandro On 27 feb, 04:06, Didier Durand durand.did...@gmail.com wrote: Yes, You can't update 2 entities that are not related by a parent (@Parent) - child relationship in a single transaction else GAE creates them in 2 separate entity groups and then throws an exception because a transaction can't update objects in more than 1 entity group. See parag Entity Groups inhttp://code.google.com/appengine/docs/java/datastore/transactions.html regards didier On Feb 26, 8:49 pm, lisandrodc lisandr...@gmail.com wrote: Hi ! I have an error at update an object: public void agregarGrupoConUsuario(Usuario usuario,Long idGrupo) { EntityTransaction et= em.getTransaction(); try { et.begin(); ControladorGrupoTorneo cGT = new ControladorGrupoTorneo(); GrupoTorneo grTorneo = cGT.devolverGrupoTorneo(idGrupo); usuario.agregarGrupoTorneo(grTorneo); em.merge(usuario); et.commit(); //the exception at commit; System.out.println(persistioUsuarioConGrupo); } finally { The error is: Caused by: java.lang.IllegalArgumentException: can't operate on multiple entity groups in a single transaction. found both Element { type: GrupoTorneo id: 3} and Element { type: Usuario id: 11 } Class Usuario: @Entity public class Usuario { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; private String nombreUsuario; private String nombre; private String apellido; private String telefono; private String password; private String mail; private String imagen; private String ciudad; private String pais; @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.REFRESH, CascadeType.MERGE}) private ListRegFechaUsuario listRegFechaUsuario; @OneToMany(cascade = {CascadeType.PERSIST, CascadeType.REMOVE, CascadeType.REFRESH, CascadeType.MERGE}) private ListGrupoTorneo gruposTorneo; /** Class GrupoTorneo: @Entity public class GrupoTorneo { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Key id; private String nombre; private String descripcion; private Date fechaCreacion; private Long idTorneo; private Long idUsuarioCreador; private String nombreUsuarioCreador; private Long idGrupo; ... ... Solution? Regards -- 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.
[appengine-java] Re: handle 1 not found error
thanks, for your reply. In fact yes, I use task queues. The error comes up when I loop through database objects, and try to persist to the database as well. I want to generate an object for a subset of objects in the database, and store them in the datastore. So my logic is: get an iterator of the objects from the datastore, iterate through them one-by-one, and persist the new object. It may not be a good thing to persist while iterating through a query but the workaround is a bit messy, I think. And I'm not even sure, what exactly the root cause is... On Feb 28, 2:26 pm, Didier Durand durand.did...@gmail.com wrote: Hi, I rather had such messages when using task queues and doing mistakes with them. Do you use task queues (or cron jobs) ? regards didier On Feb 27, 5:56 am, JaySicks jaysi...@gmail.com wrote: Hi, I'm getting the error: com.google.appengine.api.datastore.DatastoreFailureException: handle 1 not found (the number may vary) I looked up, and I found, that it's related to transactions. And I should get the error, when the too much time passes from the start of the transaction to the commit. (Am I right?) So, my problem is, that .. I'm not using transactions.. Is it normal, to get the error without using transactions? 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 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.