Dmitry
01/05/2021, 1:41 PMspring-data-jpa
in my project.
In some of my entities I am defining associations as a lateinit
fields.
Like so:
@Entity
data class Example(...) {
...
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "anotherId", insertable = false, updatable = false)
lateinit var another: AnotherEntity
}
However, it seems like hibernate does not really play well latenit
field.
After I do repository.save(example)
, if I try to access another
field I get lateinit property has not been initialized
.
Did anyone encountered such problem before?