Why do you indicate that the documentation is useless? The links I included
above state this quite clearly: two entities will be in separate entity
groups by default, even if they're the same kind. Entity groups DO NOT
collect entities of the same kind. If you need transaction support, you'll
need to explicitly set one entity as the parent of the other, which
basically creates a hierarchy (tree) of entities -- this is an entity group.
In JDO/JPA, you do this using owned relationships which is covered in my
second link above.
- Jason

On Tue, Aug 25, 2009 at 2:33 PM, Larry Cable <larry.ca...@gmail.com> wrote:

>
> I have exactly the same problem, I instantiate a number of @Entity
> objects
> (all of the same type) persist them, and flush them in the context of
> the same
> transaction.
>
> Since they are all of the same type, and their are no relationships
> (although there is
> an @Embedded class/field) I would imagine that they are all modelled
> as being in the
> same entity group .. but apparently not.
>
> The documentation is basically useless at this point ...
>
> On Aug 15, 1:09 pm, Foreigner <foreigne...@gmail.com> wrote:
> > While trying to do a bulk update on my entities using JPA I get the
> > exception bellow.
> > I understand that you can't do a bulk update on different entity groups
> in
> > the same transaction but I guess I don't quite understand what an entity
> > group is and how I go about making all entities part of the same group I
> > want.
> >
> > Thanks for the help.
> >
> > fbr
> >
> > Illegal argument
> > org.datanucleus.exceptions.NucleusUserException: Illegal argument
> >         at
> org.datanucleus.store.appengine.DatastoreExceptionTranslator.wrapIllegalArg­umentException(DatastoreExceptionTranslator.java:42)
> >         at
> org.datanucleus.store.appengine.RuntimeExceptionWrappingDatastoreService.pu­t(RuntimeExceptionWrappingDatastoreService.java:106)
> >         at
> org.datanucleus.store.appengine.DatastorePersistenceHandler.put(DatastorePe­rsistenceHandler.java:125)
> >         at
> org.datanucleus.store.appengine.DatastorePersistenceHandler.put(DatastorePe­rsistenceHandler.java:94)
> >         at
> org.datanucleus.store.appengine.DatastorePersistenceHandler.updateObject(Da­tastorePersistenceHandler.java:398)
> >         at
> org.datanucleus.state.JDOStateManagerImpl.flush(JDOStateManagerImpl.java:44­58)
> >         at
> org.datanucleus.ObjectManagerImpl.flushInternal(ObjectManagerImpl.java:2807­)
> >         at
> org.datanucleus.ObjectManagerImpl.markDirty(ObjectManagerImpl.java:2617)
> >         at
> org.datanucleus.state.JDOStateManagerImpl.postWriteField(JDOStateManagerImp­l.java:4241)
> >         at
> org.datanucleus.state.JDOStateManagerImpl.setObjectField(JDOStateManagerImp­l.java:2287)
> >         at
> com.yicook.entities.TwitterDailyTip.jdoSetlastSet(TwitterDailyTip.java)
> >         at
> com.yicook.entities.TwitterDailyTip.setLastSet(TwitterDailyTip.java:36)
> >         at
> com.yicook.control.bco.TwitterStatusSetterBCO.resetTDT(TwitterStatusSetterB­CO.java:60)
> >         at
> com.yicook.control.bco.TwitterStatusSetterBCO.execute(TwitterStatusSetterBC­O.java:40)
> >         at
> com.yicook.control.ApplicationController.executeControllers(ApplicationCont­roller.java:61)
> >         at
> com.yicook.control.ApplicationController.dispatch(ApplicationController.jav­a:41)
> >         at
> com.yicook.servlets.FrontController.doPost(FrontController.java:31)
> >         at
> com.yicook.servlets.FrontController.doGet(FrontController.java:25)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
> >         at
> org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
> >         at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandle­r.java:1093)
> >         at
> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(Trans­actionCleanupFilter.java:43)
> >         at
> org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandle­r.java:1084)
> >         at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
> >         at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
> >         at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
> >         at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
> >         at
> org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
> >         at
> com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEn­gineWebAppContext.java:54)
> >         at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
> >         at
> com.google.appengine.tools.development.JettyContainerService$ApiProxyHandle­r.handle(JettyContainerService.java:306)
> >         at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
> >         at org.mortbay.jetty.Server.handle(Server.java:313)
> >         at
> org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
> >         at
> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnecti­on.java:830)
> >         at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
> >         at
> org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
> >         at
> org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
> >         at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396­)
> >         at
> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:­442)
> > Caused by: java.lang.IllegalArgumentException: can't operate on
> > multiple entity groups in a single transaction. found both Element {
> >   type: "TwitterDailyTip"
> >   id: 77}
> >
> >  and Element {
> >   type: "TwitterDailyTip"
> >   id: 78
> >
> >
> >
> > }- 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-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