How does an entity get an ID before a transaction is committed in JPA/Play?

后端 未结 4 660
春和景丽
春和景丽 2020-12-19 05:47

See this question.

It turns out that even without committing the transaction manually, before the TX is committed, the person has an ID after calling the save() meth

4条回答
  •  醉话见心
    2020-12-19 06:14

    as i know, we can't get the object's id (assume it's a auto-numbered) before it's persisted. and i personally think that it's quite dangerous to assign something which should be done by RDBMS outside it.

提交回复
热议问题