Entity get/set in Kotlin

Clarify something for me, please. I’m migrating my project from Cuba in Java to Jmix in Kotlin.
If I have a field like this:

@JvmField
@Column(name = "SHIPPING", nullable = false)
var shipping: @NotNull Boolean? = false

When running my application, I get a runtime error stating Can't find getter for property 'shipping' at...

Before I go in and add get to every attribute of every entity, is that the different/preferred way of addressing this error?

And how would it be different for set?

Hi!

The Kotlin compiler automatically generates setters and getters for the field.
But you are using the @JvmField annotation.
This annotation instructs the Kotlin compiler not to generate getters/setters for this property and expose it as a field.
Kotlin Documentation link.

If you are using only Kotlin classes and do not extends from Java classes, you most likely do not need this annotation.
If you remove this annotation everything should work fine.

In special cases, you may need to define special getters in java-extended entities, for this, see another Kotlin Documentation link.

Regards,
Dmitriy