I have a class I’m creating with Instancio. I have an abstract parent with an id field.
When I test with Instancio, I cannot set the “id” field to null.
@MappedSuperclass
abstract class EntityWithId {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Id
@Column(name = "id")
var id = 0
}
@Entity
@Table(name = "child")
class ChildEntity : EntityWithId() {
@Basic
@Column(name = "created")
var isCreated = false
...
Instancio.of(ChildEntity::class.java)
.set(Select.field("id"), null) // Fails
However, if I move id into ChildEntity the instancio code works.
How do I select the field in the parent class?