Got it: http://stackoverflow.com/a/17378186/14731
So in the case of batched queries, it looks like I need to add explicit usage of getNextException(). I've noticed you made an attempt in JdbcBatchUpdateException to improve the situation (you print out getNextException() in printStackTrace()). Is it possible to further improve the implementation so it prints getNextException() if printStackTrace() is invoked on a wrapper exception (where getCause() returns the JdbcBatchUpdateException)? Thanks, Gili On Tuesday, October 14, 2014 2:55:47 AM UTC-4, Gili wrote: > > Sorry for the false alarm. I tracked this back to a bug in one of my DB > triggers. > > I am now investigating why the correct stacktrace being printed. I know > QueryDSL wraps the JdbcBatchUpdateException in a QueryException. Invoking > JdbcBatchUpdateException.printStackTrace() > prints the correct stack-trace but QueryException.printStackTrace() does > not (you get the truncated stack-trace seen above). > > It's not (yet) clear whether QueryException or JdbcBatchUpdateException's > implementation is at fault. > > Gili > > On Tuesday, October 14, 2014 12:42:43 AM UTC-4, Gili wrote: >> >> Hi Noel, >> >> Does this help? >> >> 00:39:50.039 [qtp381325774-3642] ERROR >> com.vtlr.backend.QueryExceptionMapper.toResponse() - SQLState: HY000 >> com.mysema.query.QueryException: Caught JdbcBatchUpdateException for >> update PERMISSION_CHILD >> set REFERENCES = REFERENCES - ? >> where PERMISSION_CHILD.PARENT_ID = ? and PERMISSION_CHILD.CHILD_ID = ? >> at >> com.mysema.query.sql.DefaultSQLExceptionTranslator.translate(DefaultSQLExceptionTranslator.java:38) >> >> >> at >> com.mysema.query.sql.Configuration.translate(Configuration.java:514) >> at >> com.mysema.query.sql.dml.SQLUpdateClause.execute(SQLUpdateClause.java:196) >> >> at com.vtlr.backend.row.Permission.removePath(Permission.java:216) >> at com.vtlr.backend.row.Permission.removeById(Permission.java:290) >> at com.vtlr.backend.row.Operator.remove(Operator.java:530) >> at >> com.vtlr.backend.resource.OperatorResource.removeOperator(OperatorResource.java:149) >> >> >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> at >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) >> >> >> at >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) >> >> >> at java.lang.reflect.Method.invoke(Method.java:483) >> at >> org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) >> >> >> at >> org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151) >> >> >> at >> org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171) >> >> >> at >> org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152) >> >> >> at >> org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104) >> >> >> at >> org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:387) >> >> >> at >> org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:331) >> >> >> at >> org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:103) >> >> >> at >> org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:271) >> at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) >> at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) >> at org.glassfish.jersey.internal.Errors.process(Errors.java:315) >> at org.glassfish.jersey.internal.Errors.process(Errors.java:297) >> at org.glassfish.jersey.internal.Errors.process(Errors.java:267) >> at >> org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:297) >> >> >> at >> org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:254) >> at >> org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1030) >> >> >> at >> org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:373) >> at >> org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381) >> >> >> at >> org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:534) >> >> >> at >> org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:482) >> >> >> at >> org.glassfish.jersey.servlet.ServletContainer.doFilter(ServletContainer.java:419) >> >> >> at >> org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650) >> >> >> at >> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583) >> >> at >> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) >> >> >> at >> org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) >> >> at >> org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) >> >> >> at >> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125) >> >> >> at >> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) >> at >> org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) >> >> >> at >> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059) >> >> >> at >> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) >> >> >> at >> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) >> >> >> at org.eclipse.jetty.server.Server.handle(Server.java:497) >> at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) >> at >> org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248) >> >> at >> org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) >> >> at >> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:610) >> >> >> at >> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:539) >> >> >> at java.lang.Thread.run(Thread.java:745) >> Caused by: org.h2.jdbc.JdbcBatchUpdateException: General error: >> "java.lang.ClassCastException: java.lang.Short cannot be cast to >> java.lang.Integer"; SQL statement: >> update PERMISSION_CHILD >> set REFERENCES = REFERENCES - ? >> where PERMISSION_CHILD.PARENT_ID = ? and PERMISSION_CHILD.CHILD_ID = ? >> [50000-181] >> at >> org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1198) >> >> >> at >> com.mysema.query.sql.dml.AbstractSQLClause.executeBatch(AbstractSQLClause.java:161) >> >> >> at >> com.mysema.query.sql.dml.AbstractSQLClause.executeBatch(AbstractSQLClause.java:171) >> >> >> at >> com.mysema.query.sql.dml.SQLUpdateClause.execute(SQLUpdateClause.java:190) >> >> ... 48 common frames omitted >> 00:39:51.137 [qtp222651412-3714] ERROR >> com.vtlr.backend.QueryExceptionMapper.toResponse() - SQLState: HY000 >> >> Gili >> >> On 14/10/2014 12:36 AM, Noel Grandin wrote: >> > Can you post the rest of the stacktrace? The actual source of the >> > exception is not shown. >> > >> > On Tue, Oct 14, 2014 at 6:21 AM, Gili <cowwoc@...> wrote: >> >> Hi, >> >> >> >> I am using H2 version 1.4.181. I am executing a PreparedStatement that >> takes >> >> 3 arguments (int, short, short) and when I do so I get the following >> >> exception: >> >> >> >> org.h2.jdbc.JdbcBatchUpdateException: General error: >> >> "java.lang.ClassCastException: java.lang.Short cannot be cast to >> >> java.lang.Integer"; SQL statement: >> >> update PERMISSION_CHILD >> >> set REFERENCES = REFERENCES - ? >> >> where PERMISSION_CHILD.PARENT_ID = ? and PERMISSION_CHILD.CHILD_ID = ? >> >> [50000-181] >> >> at >> >> >> org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1198) >> >> >> >> at >> >> >> com.mysema.query.sql.dml.AbstractSQLClause.executeBatch(AbstractSQLClause.java:161) >> >> >> >> at >> >> >> com.mysema.query.sql.dml.AbstractSQLClause.executeBatch(AbstractSQLClause.java:171) >> >> >> >> at >> >> >> com.mysema.query.sql.dml.SQLUpdateClause.execute(SQLUpdateClause.java:190) >> >> >> >> Does this indicate a bug in H2 or in my own code? >> >> >> >> Thank you, >> >> Gili >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> Groups >> >> "H2 Database" group. >> >> To unsubscribe from this group and stop receiving emails from it, send >> an >> >> email to h2-database+unsubscr...@googlegroups.com. >> >> To post to this group, send email to h2-database@googlegroups.com. >> >> Visit this group at http://groups.google.com/group/h2-database. >> >> For more options, visit https://groups.google.com/d/optout. >> >> -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to h2-database+unsubscr...@googlegroups.com. To post to this group, send email to h2-database@googlegroups.com. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.