openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wes Wannemacher" <w...@wantii.com>
Subject Re: Where to initialize the entitymanger factory
Date Tue, 11 Nov 2008 16:15:21 GMT
Spring?

http://static.springframework.org/spring/docs/2.5.x/reference/orm.html#orm-jpa

Other than that, I would suggest building a servletcontextlistener to
initialize the factory and maybe place the factory in the application
scope. Then, servlets/JSPs/whatever can request an entitymanager from
the factory.

There are better ways to tweak your access, such as using an
Open-EntityManager-In-View pattern, but if you are looking for that
sort of efficiency, I would refer back to my first suggestion
(Spring).

-Wes

On Tue, Nov 11, 2008 at 11:09 AM, Håkon Sagehaug
<Hakon.Sagehaug@bccs.uib.no> wrote:
> Hi
>
> I'm using openjpa in some web service, ant let's say I've got three
> operation that needs a EntityManager from the factory.
> One solution is to create a new EntitymanagerFactory in each method and then
> close it when the method ends, but maybe a better solution to have a static
> initialize for the web service, but not sure how this will be with different
> instances for the web service
>
> Any tips on this?
>
>
> Håkon
> --
> Håkon Sagehaug, Software Developer
> Parallab, Bergen Center for Computational Science (BCCS)
> UNIFOB AS (University of Bergen Research Company)
>



-- 
Wesley Wannemacher
President, Head Engineer/Consultant
WanTii, Inc.
http://www.wantii.com

Mime
View raw message