Re: [appengine-java] java.lang.IllegalArgumentException: can't operate on multiple entity groups in a single transaction

2010-05-19 Thread Yasuo Higa
Hi laurent,

> You can't work with more than one entity group in a single
> transaction.  This is a limitation of GAE, although other people have
> built distributed 2pc-style transactions on top of the datastore.
>
Slim3 supports Global Transactions between multiple entity groups:
http://sites.google.com/site/slim3appengine/slim3-datastore/transactions/global-transaction

You may worry about the overhead of global transactions. Don't worry.
It is not very expensive.
We prepare the demonstration:
http://slim3demo.appspot.com/gtx/

Hope this helps,

Yasuo Higa

> This should help:
>
> http://code.google.com/p/objectify-appengine/wiki/Concepts#Transactions
>
> Jeff
>
> On Wed, May 19, 2010 at 2:16 PM, laurent  wrote:
>> i've searched for this error but don't find what it is.
>>
>> my code :
>>                ObjectifyService.register(Lock.class);
>>                ObjectifyService.register(Connection.class);
>>                ObjectifyService.register(Assignment.class);
>>
>>                if 
>> (ObjectifyService.begin().query(Connection.class).countAll() ==
>> 0) {
>>
>>                        Objectify obj = ObjectifyService.beginTransaction();
>>                        obj.put(new Connection("DE PESSEMIER", "Johann", 
>> "projet"));
>>                        obj.put(new Connection("AUCQUIERE", "Eric", 
>> "projet"));
>>
>>                        obj.put(new Lock(1l));
>>
>>                        obj.getTxn().commit();
>>                }
>>
>> com.google.gwt.user.server.rpc.UnexpectedException: Service method
>> 'public abstract java.util.List
>> miro.shared.GreetingService.getConnections()' threw an unexpected
>> exception: java.lang.IllegalArgumentException: can't operate on
>> multiple entity groups in a single transaction. found both Element {
>>  type: "Connection"
>>  id: 5
>> }
>>  and Element {
>>  type: "Connection"
>>  id: 6
>> }
>>
>>        at
>> com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
>> 378)
>>        at
>> com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
>> 581)
>>        at
>> com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:
>> 188)
>>        at
>> com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:
>> 224)
>>        at
>> com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:
>> 62)
>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>>        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
>> 511)
>>        at org.mortbay.jetty.servlet.ServletHandler
>> $CachedChain.doFilter(ServletHandler.java:1166)
>>        at
>> com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
>> 51)
>>        at org.mortbay.jetty.servlet.ServletHandler
>> $CachedChain.doFilter(ServletHandler.java:1157)
>>        at
>> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
>> 43)
>>        at org.mortbay.jetty.servlet.ServletHandler
>> $CachedChain.doFilter(ServletHandler.java:1157)
>>        at
>> com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
>> 122)
>>        at org.mortbay.jetty.servlet.ServletHandler
>> $CachedChain.doFilter(ServletHandler.java:1157)
>>        at
>> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
>> 388)
>>        at
>> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
>> 216)
>>        at
>> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
>> 182)
>>        at
>> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
>> 765)
>>        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
>> 418)
>>        at
>> com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
>> 70)
>>        at
>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
>> 152)
>>        at com.google.appengine.tools.development.JettyContainerService
>> $ApiProxyHandler.handle(JettyContainerService.java:349)
>>        at
>> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
>> 152)
>>        at org.mortbay.jetty.Server.handle(Server.java:326)
>>        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
>> 542)
>>        at org.mortbay.jetty.HttpConnection
>> $RequestHandler.content(HttpConnection.java:938)
>>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
>>        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
>>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>>        at
>> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
>> 409)
>>        at org.mortbay.thread.QueuedThreadPool
>> $PoolThread.run(QueuedThreadPool.java:582)
>>
>

Re: [appengine-java] java.lang.IllegalArgumentException: can't operate on multiple entity groups in a single transaction

2010-05-19 Thread Jeff Schnitzer
You can't work with more than one entity group in a single
transaction.  This is a limitation of GAE, although other people have
built distributed 2pc-style transactions on top of the datastore.

This should help:

http://code.google.com/p/objectify-appengine/wiki/Concepts#Transactions

Jeff

On Wed, May 19, 2010 at 2:16 PM, laurent  wrote:
> i've searched for this error but don't find what it is.
>
> my code :
>                ObjectifyService.register(Lock.class);
>                ObjectifyService.register(Connection.class);
>                ObjectifyService.register(Assignment.class);
>
>                if 
> (ObjectifyService.begin().query(Connection.class).countAll() ==
> 0) {
>
>                        Objectify obj = ObjectifyService.beginTransaction();
>                        obj.put(new Connection("DE PESSEMIER", "Johann", 
> "projet"));
>                        obj.put(new Connection("AUCQUIERE", "Eric", "projet"));
>
>                        obj.put(new Lock(1l));
>
>                        obj.getTxn().commit();
>                }
>
> com.google.gwt.user.server.rpc.UnexpectedException: Service method
> 'public abstract java.util.List
> miro.shared.GreetingService.getConnections()' threw an unexpected
> exception: java.lang.IllegalArgumentException: can't operate on
> multiple entity groups in a single transaction. found both Element {
>  type: "Connection"
>  id: 5
> }
>  and Element {
>  type: "Connection"
>  id: 6
> }
>
>        at
> com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
> 378)
>        at
> com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
> 581)
>        at
> com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:
> 188)
>        at
> com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:
> 224)
>        at
> com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:
> 62)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
>        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> 511)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1166)
>        at
> com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
> 51)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
> 43)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
> 122)
>        at org.mortbay.jetty.servlet.ServletHandler
> $CachedChain.doFilter(ServletHandler.java:1157)
>        at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
> 388)
>        at
> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
> 216)
>        at
> org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
> 182)
>        at
> org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
> 765)
>        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
> 418)
>        at
> com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
> 70)
>        at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> 152)
>        at com.google.appengine.tools.development.JettyContainerService
> $ApiProxyHandler.handle(JettyContainerService.java:349)
>        at
> org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
> 152)
>        at org.mortbay.jetty.Server.handle(Server.java:326)
>        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
> 542)
>        at org.mortbay.jetty.HttpConnection
> $RequestHandler.content(HttpConnection.java:938)
>        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
>        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
>        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
>        at
> org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
> 409)
>        at org.mortbay.thread.QueuedThreadPool
> $PoolThread.run(QueuedThreadPool.java:582)
>
> Thanks for your request
>
> --
> 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 t

[appengine-java] java.lang.IllegalArgumentException: can't operate on multiple entity groups in a single transaction

2010-05-19 Thread laurent
i've searched for this error but don't find what it is.

my code :
ObjectifyService.register(Lock.class);
ObjectifyService.register(Connection.class);
ObjectifyService.register(Assignment.class);

if (ObjectifyService.begin().query(Connection.class).countAll() 
==
0) {

Objectify obj = ObjectifyService.beginTransaction();
obj.put(new Connection("DE PESSEMIER", "Johann", 
"projet"));
obj.put(new Connection("AUCQUIERE", "Eric", "projet"));

obj.put(new Lock(1l));

obj.getTxn().commit();
}

com.google.gwt.user.server.rpc.UnexpectedException: Service method
'public abstract java.util.List
miro.shared.GreetingService.getConnections()' threw an unexpected
exception: java.lang.IllegalArgumentException: can't operate on
multiple entity groups in a single transaction. found both Element {
  type: "Connection"
  id: 5
}
 and Element {
  type: "Connection"
  id: 6
}

at
com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:
378)
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:
581)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:
188)
at
com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:
224)
at
com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:
62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
511)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1166)
at
com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:
51)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:
43)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:
122)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
388)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
182)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
418)
at
com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:
70)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at com.google.appengine.tools.development.JettyContainerService
$ApiProxyHandler.handle(JettyContainerService.java:349)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
542)
at org.mortbay.jetty.HttpConnection
$RequestHandler.content(HttpConnection.java:938)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
409)
at org.mortbay.thread.QueuedThreadPool
$PoolThread.run(QueuedThreadPool.java:582)

Thanks for your request

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