Re: creating long expressions

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Dec 06 2006 - 03:06:37 EST

  • Next message: Peter Schröder: "AW: AW: AW: updating large number of data"

    Can't comment on Derby, but it is a good idea to call huge queries
    via a named query - you'll save some time on data transfer. Also
    another point is raised here - serialization behavior of the server-
    side exceptions is unpredictable so we may need to add an abstraction
    layer to the servlet. Sorry - that's a bit OT.

    Andrus

    On Dec 6, 2006, at 6:12 AM, Marcin Skladaniec wrote:
    > Hello
    > I tried a few approaches. I made the query to the server with
    > NamedQuery and something like :
    >
    > Map map = new HashMap();
    > map.put( "entityName", "Apple" );
    > map.put( "fieldName", "numberOfWormsInTheApple" );
    > if (finalExpression != null ) {
    > map.put("whereClause", "WHERE "+finalExpression.toString());
    > } else {
    > map.put("whereClause", "");
    > }
    > NamedQuery namedQuery = new NamedQuery("SumQuery", map);
    >
    > and the sql on the other end looking like :
    > SELECT sum($fieldName) FROM $entityName $whereClause
    >
    > The query gets to the server, but an exception is thrown, what I
    > get suggest that there is a limit on query length in derby. I tried
    > to execute the long expression in squirrel, getting
    > StackOveflowError too.
    > Can someone confirm that there is a limit on sql query length in
    > derby ? There is nothing in google about that.
    > Marcin
    >
    > Ps: I get this from server :
    > java.lang.IllegalStateException: Serialized class
    > org.apache.derby.client.net.NetSqlca does not implement
    > java.io.Serializable
    > at com.caucho.hessian.io.JavaSerializer.<init>
    > (JavaSerializer.java)
    > at
    > com.caucho.hessian.io.SerializerFactory.getDefaultSerializer
    > (SerializerFactory.java:200)
    > at com.caucho.hessian.io.SerializerFactory.getSerializer
    > (SerializerFactory.java)
    > at com.caucho.hessian.io.HessianOutput.writeObject
    > (HessianOutput.java:315)
    > at com.caucho.hessian.io.JavaSerializer
    > $FieldSerializer.serialize(JavaSerializer.java:242)
    > at com.caucho.hessian.io.JavaSerializer.writeObject10
    > (JavaSerializer.java:175)
    > at com.caucho.hessian.io.JavaSerializer.writeObject
    > (JavaSerializer.java:157)
    > at com.caucho.hessian.io.ThrowableSerializer.writeObject
    > (ThrowableSerializer.java:71)
    > at com.caucho.hessian.io.HessianOutput.writeObject
    > (HessianOutput.java:317)
    > at com.caucho.hessian.io.JavaSerializer
    > $FieldSerializer.serialize(JavaSerializer.java:242)
    > at com.caucho.hessian.io.JavaSerializer.writeObject10
    > (JavaSerializer.java:175)
    > at com.caucho.hessian.io.JavaSerializer.writeObject
    > (JavaSerializer.java:157)
    > at com.caucho.hessian.io.ThrowableSerializer.writeObject
    > (ThrowableSerializer.java:71)
    > at com.caucho.hessian.io.HessianOutput.writeObject
    > (HessianOutput.java:317)
    > at com.caucho.hessian.io.HessianOutput.writeFault
    > (HessianOutput.java:297)
    > at com.caucho.hessian.server.HessianSkeleton.invoke
    > (HessianSkeleton.java:165)
    > at com.caucho.hessian.server.HessianServlet.service
    > (HessianServlet.java:365)
    > at ish.oncourse.server.CayenneServlet.service
    > (CayenneServlet.java:104)
    > at org.mortbay.jetty.servlet.ServletHolder.handle
    > (ServletHolder.java:428)
    > at org.mortbay.jetty.servlet.ServletHandler.dispatch
    > (ServletHandler.java:666)
    > at org.mortbay.jetty.servlet.ServletHandler.handle
    > (ServletHandler.java:568)
    > at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
    > at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
    > at org.mortbay.http.HttpServer.service(HttpServer.java:909)
    > at org.mortbay.http.HttpConnection.service
    > (HttpConnection.java:816)
    > at org.mortbay.http.HttpConnection.handleNext
    > (HttpConnection.java:982)
    > at org.mortbay.http.HttpConnection.handle
    > (HttpConnection.java:833)
    > at org.mortbay.http.SocketListener.handleConnection
    > (SocketListener.java:244)
    > at org.mortbay.util.ThreadedServer.handle
    > (ThreadedServer.java:357)
    > at org.mortbay.util.ThreadPool$PoolThread.run
    > (ThreadPool.java:534)
    >
    >
    >
    > On 06/12/2006, at 11:56 AM, Marcin Skladaniec wrote:
    >
    >> Hi
    >> I create a really long org.cayenne.exp.Expression. The longest I
    >> created so far, had 63000 characters as string. The problem is
    >> that after reaching certain (not sure what size, need to test
    >> more) size I get:
    >>
    >> Exception in thread "Thread-8"
    >> org.apache.cayenne.CayenneRuntimeException: [v.3.0-incubating-
    >> SNAPSHOT ] Remote error. URL - http://localhost:8181/angel-server-
    >> cayenne
    >> at
    >> org.apache.cayenne.remote.hessian.HessianConnection.doSendMessage
    >> (HessianConnection.java:145)
    >> at org.apache.cayenne.remote.BaseConnection.sendMessage
    >> (BaseConnection.java:73)
    >> at org.apache.cayenne.remote.ClientChannel.send
    >> (ClientChannel.java:276)
    >> at org.apache.cayenne.remote.ClientChannel.onQuery
    >> (ClientChannel.java:110)
    >> at
    >> org.apache.cayenne.util.ObjectContextQueryAction.runQuery
    >> (ObjectContextQueryAction.java:282)
    >> at org.apache.cayenne.CayenneContextQueryAction.execute
    >> (CayenneContextQueryAction.java:51)
    >> at org.apache.cayenne.CayenneContext.onQuery
    >> (CayenneContext.java:347)
    >> at org.apache.cayenne.CayenneContext.performQuery
    >> (CayenneContext.java:336)
    >> at ish.oncourse.cayenne.CayenneContext.performQuery
    >> (CayenneContext.java:152)
    >> at
    >> ish.oncourse.print.ProfitLossPrintableObject.getTransactionsFromRecor
    >> ds(ProfitLossPrintableObject.java:180)
    >> at ish.oncourse.controller.PrintController$1.construct
    >> (PrintController.java:263)
    >> at ish.oncourse.view.SwingWorker$2.run(SwingWorker.java:117)
    >> at java.lang.Thread.run(Thread.java:613)
    >> Caused by: java.lang.StackOverflowError
    >> at java.util.IdentityHashMap.hash(IdentityHashMap.java:283)
    >> at java.util.IdentityHashMap.get(IdentityHashMap.java:313)
    >> at com.caucho.hessian.io.HessianOutput.addRef
    >> (HessianOutput.java:799)
    >> at com.caucho.hessian.io.JavaSerializer.writeObject
    >> (JavaSerializer.java:134)
    >> at com.caucho.hessian.io.HessianOutput.writeObject
    >> (HessianOutput.java:317)
    >> at com.caucho.hessian.io.JavaSerializer
    >> $FieldSerializer.serialize(JavaSerializer.java:242)
    >> at com.caucho.hessian.io.JavaSerializer.writeObject10
    >> (JavaSerializer.java:175)
    >> at com.caucho.hessian.io.JavaSerializer.writeObject
    >> (JavaSerializer.java:157)
    >> at com.caucho.hessian.io.HessianOutput.writeObject
    >> (HessianOutput.java:317)
    >> at com.caucho.hessian.io.JavaSerializer
    >> $FieldSerializer.serialize(JavaSerializer.java:242)
    >> at com.caucho.hessian.io.JavaSerializer.writeObject10
    >> (JavaSerializer.java:175)
    >> at com.caucho.hessian.io.JavaSerializer.writeObject
    >> (JavaSerializer.java:157)
    >>
    >> It looks like hessian is failing to serialise the Expression. I'm
    >> I right ? If so I'll post them a bug report.
    >>
    >> Marcin
    >
    > -------------------------->
    > ish
    > http://www.ish.com.au
    > Level 1, 30 Wilson Street Newtown 2042 Australia
    > phone +61 2 9550 5001 fax +61 2 9550 4001
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Dec 06 2006 - 03:07:22 EST