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

Reply via email to