EbeanのSqlUpdateで、in句のパラメータにList型をsetParamaterできない
JavaからEbeanつかってupdate文を実行したいのですが、
どうやらsetParameterでList型が渡せていない様子です。
下記ソースコードの「Ebean.execute(update_toActive);」でPersistenceExceptionが発生しています。
どこか間違っているのか、それとも仕様なので別の方法を模索せねばならないのか、
どなたかアドバイスお願いいたします。
・開発環境
- jdk1.7.0_79
- windows7
- eclipse Mars.1 Release (4.5.1)
- playframework2.3
・ソースコード(テーブル名等は別名に変更済み)
public static void sampleMethod(String param1, String param2, List<String> param3) {
// 無効 -> 有効
StringBuffer sb = new StringBuffer();
sb.append(" update table_1 set");
sb.append(" col_1 = '有効'");
sb.append(" where");
sb.append(" col_2 = ?");
sb.append(" and col_3 = ?");
sb.append(" and col_4 in (?)");
SqlUpdate update_toActive = Ebean.createSqlUpdate(sb.toString());
update_toActive.setParameter(1, param1);
update_toActive.setParameter(2, param2);
update_toActive.setParameter(3, param3);
Ebean.execute(update_toActive);
}
・エラーログ
javax.persistence.PersistenceException: No ScalarType registered for class java.util.Arrays$ArrayList
at com.avaje.ebeaninternal.server.persist.Binder.bindObject(Binder.java:165) ~[avaje-ebeanorm-3.3.4.jar:na]
at com.avaje.ebeaninternal.server.persist.Binder.bind(Binder.java:139) ~[avaje-ebeanorm-3.3.4.jar:na]
at com.avaje.ebeaninternal.server.persist.Binder.bind(Binder.java:97) ~[avaje-ebeanorm-3.3.4.jar:na]
at com.avaje.ebeaninternal.server.persist.Binder.bind(Binder.java:87) ~[avaje-ebeanorm-3.3.4.jar:na]
at com.avaje.ebeaninternal.server.persist.ExeUpdateSql.bindStmt(ExeUpdateSql.java:129) ~[avaje-ebeanorm-3.3.4.jar:na]
at com.avaje.ebeaninternal.server.persist.ExeUpdateSql.execute(ExeUpdateSql.java:56) ~[avaje-ebeanorm-3.3.4.jar:na]
at com.avaje.ebeaninternal.server.persist.DefaultPersistExecute.executeSqlUpdate(DefaultPersistExecute.java:115) ~[avaje-ebeanorm-3.3.4.jar:na]
at com.avaje.ebeaninternal.server.core.PersistRequestUpdateSql.executeNow(PersistRequestUpdateSql.java:44) ~[avaje-ebeanorm-3.3.4.jar:na]
at com.avaje.ebeaninternal.server.core.PersistRequest.executeStatement(PersistRequest.java:74) ~[avaje-ebeanorm-3.3.4.jar:na]
at com.avaje.ebeaninternal.server.core.PersistRequestUpdateSql.executeOrQueue(PersistRequestUpdateSql.java:49) ~[avaje-ebeanorm-3.3.4.jar:na]
at com.avaje.ebeaninternal.server.persist.DefaultPersister.executeSqlUpdate(DefaultPersister.java:135) ~[avaje-ebeanorm-3.3.4.jar:na]
at com.avaje.ebeaninternal.server.core.DefaultServer.execute(DefaultServer.java:1928) ~[avaje-ebeanorm-3.3.4.jar:na]
at com.avaje.ebeaninternal.server.core.DefaultServer.execute(DefaultServer.java:1935) ~[avaje-ebeanorm-3.3.4.jar:na]
at com.avaje.ebean.Ebean.execute(Ebean.java:1130) ~[avaje-ebeanorm-3.3.4.jar:na]
at models.database.HandleConfig.updateHandleConfigsStatus(HandleConfig.java:204) ~[classes/:na]
at controllers.TutorCtl.changeTutor(TutorCtl.java:330) ~[classes/:2.3.7]
at Routes$$anonfun$routes$1$$anonfun$applyOrElse$31$$anonfun$apply$31.apply(routes_routing.scala:1188) [classes/:na]
at Routes$$anonfun$routes$1$$anonfun$applyOrElse$31$$anonfun$apply$31.apply(routes_routing.scala:1188) [classes/:na]
at play.core.Router$HandlerInvokerFactory$$anon$4.resultCall(Router.scala:264) [play_2.11-2.3.7.jar:2.3.7]
at play.core.Router$HandlerInvokerFactory$JavaActionInvokerFactory$$anon$15$$anon$1.invocation(Router.scala:255) [play_2.11-2.3.7.jar:2.3.7]
at play.core.j.JavaAction$$anon$1.call(JavaAction.scala:55) [play_2.11-2.3.7.jar:2.3.7]
at play.GlobalSettings$1.call(GlobalSettings.java:67) [play_2.11-2.3.7.jar:2.3.7]
at play.mvc.Security$AuthenticatedAction.call(Security.java:44) [play_2.11-2.3.7.jar:2.3.7]
at play.filters.csrf.RequireCSRFCheckAction.call(RequireCSRFCheckAction.java:25) [filters-helpers_2.11-2.3.7.jar:2.3.7]
at play.core.j.JavaAction$$anonfun$11.apply(JavaAction.scala:82) [play_2.11-2.3.7.jar:2.3.7]
at play.core.j.JavaAction$$anonfun$11.apply(JavaAction.scala:82) [play_2.11-2.3.7.jar:2.3.7]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) [scala-library-2.11.1.jar:na]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) [scala-library-2.11.1.jar:na]
at play.core.j.HttpExecutionContext$$anon$2.run(HttpExecutionContext.scala:40) [play_2.11-2.3.7.jar:2.3.7]
at play.api.libs.iteratee.Execution$trampoline$.execute(Execution.scala:46) [play-iteratees_2.11-2.3.7.jar:2.3.7]
at play.core.j.HttpExecutionContext.execute(HttpExecutionContext.scala:32) [play_2.11-2.3.7.jar:2.3.7]
at scala.concurrent.impl.Future$.apply(Future.scala:31) [scala-library-2.11.1.jar:na]
at scala.concurrent.Future$.apply(Future.scala:492) [scala-library-2.11.1.jar:na]
at play.core.j.JavaAction$class.apply(JavaAction.scala:82) [play_2.11-2.3.7.jar:2.3.7]
at play.core.Router$HandlerInvokerFactory$JavaActionInvokerFactory$$anon$15$$anon$1.apply(Router.scala:252) [play_2.11-2.3.7.jar:2.3.7]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) [play_2.11-2.3.7.jar:2.3.7]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) [play_2.11-2.3.7.jar:2.3.7]
at play.utils.Threads$.withContextClassLoader(Threads.scala:21) [play_2.11-2.3.7.jar:2.3.7]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:129) [play_2.11-2.3.7.jar:2.3.7]
at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:128) [play_2.11-2.3.7.jar:2.3.7]
at scala.Option.map(Option.scala:145) [scala-library-2.11.1.jar:na]
at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:128) [play_2.11-2.3.7.jar:2.3.7]
at play.api.mvc.Action$$anonfun$apply$1.apply(Action.scala:121) [play_2.11-2.3.7.jar:2.3.7]
at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:483) [play-iteratees_2.11-2.3.7.jar:2.3.7]
at play.api.libs.iteratee.Iteratee$$anonfun$mapM$1.apply(Iteratee.scala:483) [play-iteratees_2.11-2.3.7.jar:2.3.7]
at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:519) [play-iteratees_2.11-2.3.7.jar:2.3.7]
at play.api.libs.iteratee.Iteratee$$anonfun$flatMapM$1.apply(Iteratee.scala:519) [play-iteratees_2.11-2.3.7.jar:2.3.7]
at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:496) [play-iteratees_2.11-2.3.7.jar:2.3.7]
at play.api.libs.iteratee.Iteratee$$anonfun$flatMap$1$$anonfun$apply$14.apply(Iteratee.scala:496) [play-iteratees_2.11-2.3.7.jar:2.3.7]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) [scala-library-2.11.1.jar:na]
at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) [scala-library-2.11.1.jar:na]
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:41) [akka-actor_2.11-2.3.4.jar:na]
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393) [akka-actor_2.11-2.3.4.jar:na]
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [scala-library-2.11.1.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [scala-library-2.11.1.jar:na]
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [scala-library-2.11.1.jar:na]
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) [scala-library-2.11.1.jar:na]