Search code examples
javaspring-bootjdbi

JDBI org.skife.jdbi.v2.exceptions.UnableToCreateStatementException: Exception while binding


While I try to execute below code, I get UnableToCreateStatementException exception with Caused by:

java.sql.SQLException: Parameter index out of range (11 > number of parameters, which is 10).

   @SqlUpdate(
          "update  vehicle_pre_inspection set "
              + "`trip_type`=:trip_type,"
              + "`trip_id`=:trip_id,"
              + "`is_container_sealed`=:is_container_sealed,"
              + "`hidden_lock_present`=:hidden_lock_present,"
              + "`tarpaulin_present`=:tarpaulin_present,"
              + "`cargonet_hooks_present`=:cargonet_hooks_present, "
              + "`floor_tarpaulin_present =:floor_tarpaulin_present`,"
              + "`ceiling_tarpaulin_present=:ceiling_tarpaulin_present`,"
              + "`task_id`=:task_id, "
              + "`last_updated_at`= :lastUpdatedAt, "
              + "`last_updated_by_id`= :lastUpdatedById "
              + " where `id` = :id ")

      void update(
          @Bind("trip_type") String trip_type,
          @Bind("trip_id") Long trip_id,
          @Bind("is_container_sealed") Boolean is_container_sealed,
          @Bind("hidden_lock_present") Boolean hidden_lock_present,
          @Bind("tarpaulin_present") Boolean tarpaulin_present,
          @Bind("cargonet_hooks_present") Boolean cargonet_hooks_present,
          @Bind("floor_tarpaulin_present") Boolean floor_tarpaulin_present,
          @Bind("ceiling_tarpaulin_present") Boolean ceiling_tarpaulin_present,
          @Bind("task_id") Long task_id,
          @Bind("lastUpdatedAt") Long lastUpdatedAt,
          @Bind("lastUpdatedById") Long lastUpdatedById,
          @Bind("id") Long id);

Solution

  • Check the lines: + "floor_tarpaulin_present =:floor_tarpaulin_present," and + "ceiling_tarpaulin_present=:ceiling_tarpaulin_present,"

    the closing carat (`) is present in the wrong location.