当插入行应返回用于主键列的序列号时的jpa(jpa when insert row should return the sequence number used for primary key column)
我知道在sql(oracle)中我们可以使用“retruning into”但是在使用em.create()时可以使用JPA自动化。
I know in sql(oracle) we can use "retruning into" but is there something which can be automated using JPA when using em.create().
最满意答案
尝试使用em.merge(),它返回刚刚保留的附加实例。 在看到生成的主键之前,您可能必须使用em.flush()。
Try em.merge(), it returns the attached instance you just persisted. You might have to em.flush() before you see the generated primary key.
更多推荐
发布评论