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
Given an @Embedded.Nullable on a property whose object contains a property with a collection type, e.g. list (backed by a varchar array in the DB), the annotated object is returned non-null even for a null value of this collection.
data classEntity(
@Embedded.Nullablevalembedded:EmbeddedObject?
) {
@Id
var id:Long?=null
}
data classEmbeddedObject(
@Column("values")
valvalues:List<String>?
)
For a row with values = null, the mapper results in the embedded property being a non-null object, and its property values is null.
I guess this is a bug, as it goes against the documented behavior:
the load strategy for the embedded object if all contained fields yield null values.
which should hold for an embedded with a single collection field yielding a null value.
version: 3.2.2
The text was updated successfully, but these errors were encountered:
Placing collections in an embeddable is somewhat problematic as the current code only checks values from the current row in ResultSet. To determine whether there are values, we would have to run a query to check whether there are values. Then run another query to fetch the actual rows. With a single property, all this can be done, but running multiple queries for multiple relationship properties is where it becomes problematic.
I agree this is a bug and we need to take care of it.
Maybe I am lost in the context, but the collection is part of the current row when it is an array column. So, no additional query should be needed.
The code imho already has all the information needed to return the correct null result for the embedded object, as it needed to fill all the null fields in it already.
Given an
@Embedded.Nullable
on a property whose object contains a property with a collection type, e.g. list (backed by a varchar array in the DB), the annotated object is returned non-null even for a null value of this collection.For a row with
values = null
, the mapper results in theembedded
property being a non-null object, and its propertyvalues
isnull
.I guess this is a bug, as it goes against the documented behavior:
which should hold for an embedded with a single collection field yielding a null value.
version: 3.2.2
The text was updated successfully, but these errors were encountered: