Kotlin and not-null reference

I have some questions.

I did this and it’s ok

    @Column(name = "VALUE", nullable = false)
    @NotNull
    var value: String? = null

but it would be better to have

    @Column(name = "VALUE", nullable = false)
    @NotNull
    lateinit var value: String

Is-it possible ? I get some errors during execution…

When a collection is used, Studio generate something like

    @Composition
    @OneToMany(mappedBy = "parent")
    @OnDeleteInverse(DeletePolicy.UNLINK)
    @OnDelete(DeletePolicy.CASCADE)
    var children: MutableList<Child> = NotInstantiatedList()

It’s good, then I add a computed value based on this collection

    @Transient
    @JmixProperty
    @DependsOnProperties("children")
    val lastChild: Child? 
        get() = children.maxBy { it.date } else null

I get java.util.NoSuchElementException during execution.
How can I do ?

Hello @b.vallettedosia !

Thank you for reporting the problem, I’ve created an issue for it

As a workaround you can check if the value of a collection is an instance of io.jmix.core.entity.NoValueCollection and return null in such case.