I keep is simple by implementing an EntityService and let it handle the errors and such, so I can standardise error handling, persisting or merging decisions etc. Then I just have a private static instance of the factory so it gets shared application wide. Also for perfomance purposes I keep a cach of entity managers so I don't have to continually instantiate new ones because of the performance hit of doing so.
Chris -----Original Message----- From: gilbertoca [mailto:[email protected]] Sent: Saturday, 15 May 2010 12:48 AM To: [email protected] Subject: RE: InvalidStateException Thanks Chris, now I see the problem. So my approach is not correct! Should it be: EntityManagerFactory -- ServletContext[by a filter or listener] EntityManager -- page [by request or session] Can anyone point me the right direction on the ServletContext[by a filter or listener] implementation example? Thanks again, Gilberto -- View this message in context: http://openjpa.208410.n2.nabble.com/InvalidStateException-tp210537p5051257.h tml Sent from the OpenJPA Users mailing list archive at Nabble.com.
