Hi, Please ask such kind of questions in [email protected]. dev@ is about developing Wicket itself, not about developing with Wicket.
About the question: Usually applications use JavaEE containers to provide such kind of resources or Spring Framework. In both cases you need to configure EntityManagerFactory and then use it to create EntityManagers for each request. On Thu, Aug 2, 2018 at 11:11 AM MG Ferreira <[email protected]> wrote: > Hi there, > > I am looking at using Wicket for a project and have done some prototyping. > It looks great, but I need a bit of guidance please. I am also new to JPA > but have used JaveEE before. Then I used a @Resource tag and did not wonder > about what happened under the hood as much as now. > > In the prototype I annotated a class with @WebListener and implemented > ServletContextListener to instantiate the EntityManager once and then would > use this class to get to the singleton EntityManager. It works great but I > think I have to rethink what will happen in a multiuser environment. I like > this approach as the instantiation happens once and I can probably wrap > code inbetween start and end transactions where needed but wonder about > scaling and so on. Any suggestions? > > I think the alternative is to instantiate the EntityManager as part of a > WebPage’s init or maybe somewhere in the request cycle. Can I use the > singleton approach above or is there some standard pattern in which an > EntityManager is used? > > TIA > skaak
