Skip to content

Missing Nullability annotation on JdbcTemplate.batchUpdate #37011

Closed as duplicate

Description

@alshain

From Kotlin, calling JdbcTemplate.batchUpdate with an array containing nulls is impossible because of a missing nullability annotation:

jdbcTemplate.batchUpdate(
  """
  INSERT INTO "my_table" ("non_null", "can_be_null") VALUES (?, ?)
  """,
  listOf(
    arrayOf<Any?>(
      "non-null",
      null,
    )
  )
)

Error:

None of the following candidates is applicable:
<SNIP>
                                                             vvvvvvvvv
fun batchUpdate(sql: String, batchArgs: (Mutable)List<Array<(out) Any>>): IntArray:
Argument type mismatch: actual type is 'List<Array<Any?>>', but '(Mutable)List<Array<(out) Any>>' was expected.

Proposed solution

Change to List<@Nullable Object[]> here:

@Override
public int[] batchUpdate(String sql, List<Object[]> batchArgs) throws DataAccessException {
return batchUpdate(sql, batchArgs, new int[0]);
}
@Override
public int[] batchUpdate(String sql, List<Object[]> batchArgs, int[] argTypes) throws DataAccessException {
if (batchArgs.isEmpty()) {

Activity

  1. added a commit that references this issue on Jul 7, 2026
    56ba878
  2. sdeleuze commented on Jul 7, 2026

    @sdeleuze
    Contributor

    Closing this issue in favor of the related PR #37012.

    @alshain Next time, no need to create an issue before the related PR, see https://github.com/spring-projects/spring-framework/blob/main/CONTRIBUTING.md#submit-a-pull-request.

  3. added
    status: supersededAn issue that has been superseded by another
    and removed on Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: supersededAn issue that has been superseded by another

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions