Skip to content

Empty Set<Long> is passed as null #3773

@kevinm416

Description

@kevinm416

I have a repository method:

  @org.springframework.data.jpa.repository.Query(
      nativeQuery = true,
      value = """
          SELECT cast(:productIds as TEXT) IS NULL
          """
  )
  boolean sanityCheck(Set<Long> productIds);

When I pass in an empty set, the empty set is converted to null somewhere before it makes it to the DB (Postgres):

Query:["SELECT cast((null) as TEXT) IS NULL
"], Params:[()]

Is this behavior documented anywhere? I don't understand why this would be expected or desirable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: external-projectFor an external project and not something we can fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions