I have few validations on my entity, like @NotNull
, and some generation, like
@Id
@GeneratedValue(strategy = AUTO)
@Column(name = "ID")
private Long id;
@Column
@GeneratedValue(strategy = GenerationType.AUTO)
private Long referenceNumber;
However when calling EntityManager.merge()
this values are not generated. Null fields with @NotNull
annotation are passed without any complain. Even id
is not generated.
Should I switch this generation on somehow? How, and where?
Merge()
does not invoke pre-insert/pre-update event listeners by default. flush()
after the merge()
should do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With