JPA @EmbeddedId is not generating sequence

前端 未结 2 889
清酒与你
清酒与你 2021-01-05 07:39

I have a table which has composite primary key consisting one sequence and two foreign keys I am able to persist My entity class but it is not generating according to the se

2条回答
  •  失恋的感觉
    2021-01-05 08:15

    There's one workaround for this issue. I've faced the same condition, have 4 fields as composite keys, out of which 1 need to be generated by sequence. I've not created Embedded class at all, only have 1 @Id field which need to be generated by sequence. Rest all field values will be simple columns, as referential integrity are enforced in DB and also I'm checking values of rest of 3 fields in code to be not null.

    In case of error the transaction will rollback.

提交回复
热议问题