-
1. Re: Performance question on EntityManager
mimra Dec 6, 2006 9:24 AM (in response to akrishmohan)Hi
When the entity manager is injected, it is managed by the container, and you should not close it yourself.
/Michael -
2. Re: Performance question on EntityManager
akrishmohan Dec 6, 2006 12:54 PM (in response to akrishmohan)So, for my scenario what do you think is the best ? Let the container manage it after injection or I create one and manage it myself ?
Let me know
Thanks
K -
3. Re: Performance question on EntityManager
markvl Dec 6, 2006 8:34 PM (in response to akrishmohan)In this scenario there is no advantage in using multiple entity managers, so you should let the container handle it.
If anything, in this scenario the use of multiple entity managers may slow down your app as it may mean updates / deletes are flushed more frequently than they need to be.
I suggest you code it the simplest way, ie container managed, then if performance is unacceptable look for bottlenecks to be optimised. -
4. Re: Performance question on EntityManager
akrishmohan Dec 7, 2006 12:54 AM (in response to akrishmohan)Thanks for your response.
Coming back to the problem, basically, I am supposed to update DB with contents of a file. If anything happens during data insertion, the whole transaction needs to be rolled back. So the reading of file and updating it into the DB should be in one transaction unit. Since there are multiple files to be read, I was wondering if I could open the entity manager before file-read/DB-update and close immediately after. Will CMP still yield better performance for this case too? Sorry if I sound repetitive.
I am just trying to understand how Container Manager Persistence (CMP) demarcates the transaction here and handles persistence.
Thanks
K