Closed takithon closed 4 years ago
both spring-cloud-gcp-data-spanner-1.2.0.RELEASE and 1.2.1.RELEASE. Only I checked.
I used @Query annotation and DML statement, then pass the null value for the nullable column.
@Query
NullPointerException at SqlSpannerQuery.
I want to input null value in the table if I passed null value to the method and the column is nullable.
Assume that lastName is the nullable column at the singer table.
lastName
Define a method like below at the repository with extends of SpannerRepository
@Query(dmlStatement = true, value = "INSERT INTO singer (singer_id, birth_date, first_name, last_name) VALUES (@singerId, @birthDay, @firstName, @lastName)") public void insert(Integer singerId, Date birthDay, String firstName, String lastName);
Then use it like below
xxxRepository.insert(3, Date.valueOf(LocalDate.of(1994, 12, 27)), "first_name", null);
Thanks for reporting the issue, I think I have a fix for this.
Thank you for corresponding it. I'm going to continue to watch the PR.
Version
both spring-cloud-gcp-data-spanner-1.2.0.RELEASE and 1.2.1.RELEASE. Only I checked.
What I did
I used
@Query
annotation and DML statement, then pass the null value for the nullable column.What was occurred
NullPointerException at SqlSpannerQuery.
What I was expected
I want to input null value in the table if I passed null value to the method and the column is nullable.
Situation the phenomena occurs
Assume that
lastName
is the nullable column at the singer table.Define a method like below at the repository with extends of SpannerRepository
Then use it like below