XdQuery.mapDistinct is not working for optional fields
lehvolk opened this issue · 4 comments
lehvolk commented
queryEngine.selectDistinct can return collection with null values inside but XdQuery treated all values inside as not-null therefore iterating of XdQuery will fail.
As I see there are few possibilities to fix it:
- make XdQuery parametrisation optional <T?>
- wrap result of selectDistinct into ExcludeNullStaticTypedEntityIterable
sedovalx commented
Can you give an example when nulls are valid values?
lehvolk commented
@sedovalx just run this code and get exception
val boss = store.transactional {
User.new {
login = "boss"
skill = 1
}
}
store.transactional {
User.new {
login = "slave"
supervisor = boss
skill = 1
}
}
store.transactional {
User.all().mapDistinct(User::supervisor).asSequence().forEach {
println(it.login)
}
}
sedovalx commented
@lehvolk take a look at the sedovalx@e8ab689