-
Is it okay to create a new EntityManager instance every time a new request is received? |
Beta Was this translation helpful? Give feedback.
Answered by
edobrb
May 24, 2022
Replies: 1 comment
-
Absolutely yes, you should create a new EntityManager for each request. In some cases you may want to instantiate an EntityManager with different metadata depending on the user. Also, all the DAO inside the EntityManager are lazy instantiated so it's quite lightweight. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Atlinx
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Absolutely yes, you should create a new EntityManager for each request. In some cases you may want to instantiate an EntityManager with different metadata depending on the user. Also, all the DAO inside the EntityManager are lazy instantiated so it's quite lightweight.