How to get id from an entity before em.flush() ? #6529
Answered
by
B4nan
sonicgamer0721
asked this question in
Q&A
-
Hi, my code looks like this:
I want to run "em.flush()" once, like:
I searched the Docs and got no answer. Is there any way to achieve this? |
Beta Was this translation helpful? Give feedback.
Answered by
B4nan
Mar 19, 2025
Replies: 1 comment 11 replies
-
You cant get the ID before flush since flush is what does the insert queries. But you don't need it, you just need a relation between those entities. |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
oh right, sorry, now i get it. the PK of your
Employee
is the user entity itself, they share the same PK value:you also need to use the
PrimaryKeyProp
symbol on theEmployee
to state on type level that your PK is calleduser
: