You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As written in this comment #1737 (comment) after upgrading to spring-data-jdbc 3.3.1 when I load an entity with a text[] column (mapped as List<String>) that is empty using findById the column is set to null.
My guess is that bug was introduced by this issue #1737 but I didn't look into the changes to confirm that.
An example of my setup taken from the comment linked above:
Using a combination of Java + Kotlin:
My Entity: (Java + Lombok)
createtablemy_table
(
id uuid not null,
version bigintnot null,
tags text[] not null,
constraint pk_my_table primary key (id)
);
My test case (Kotlin)
@Repository
interfaceMyTableRepository: CrudRepository<MyTable, UUID>, PagingAndSortingRepository<MyTable, UUID>
@Test
funtest() {
val instance = myTableRepository.save(MyTable(null, 0, emptyList())) // instance.tags is still an empty list
assertNotNull(myTableRepository.findById(instance.id).get().tags) // data from db tags is null
}
The text was updated successfully, but these errors were encountered:
Please provide a Minimimal Reproducable Example, preferable as a Github repository. Make sure to include the database, either as an in memory database or if that is not possible using Testcontainers.
I used a postgres testcontainer because thats where I also discovered the issue in my code.
You can find the failing test under com.example.springjdbcnullissue.SpringJdbcNullIssueApplicationTests#testNullTextArray
(JDK used is 21)
When changing the version of the org.springframework.boot plugin in the build.gradle.kts to 3.3.0 from 3.3.1 the test case succeeds.
As written in this comment #1737 (comment) after upgrading to spring-data-jdbc
3.3.1
when I load an entity with atext[]
column (mapped asList<String>
) that is empty usingfindById
the column is set tonull
.My guess is that bug was introduced by this issue #1737 but I didn't look into the changes to confirm that.
An example of my setup taken from the comment linked above:
Using a combination of Java + Kotlin:
My Entity: (Java + Lombok)
My database table (postgres):
My test case (Kotlin)
The text was updated successfully, but these errors were encountered: