users@jersey.java.net

Re: [Jersey] synchronized

From: Felipe Gaúcho <fgaucho_at_gmail.com>
Date: Wed, 20 May 2009 09:52:39 +0200

ok, now I started to realize the scenario of the problem..

I am injecting the facade (stateless entity beans).. that contains the
entitymanager, etc..

so, I have codes like that:

---------------
@Path("event")
public class EventResource {
        @EJB private FpEventFacade eventFacade;

        @PUT
        @Produces( { MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
        @Path("create")
        public FpEvent create(FpEvent event) {
                return eventFacade.create(event);
        }

----------------


question: how can I refactor this code in order to have all allocated
resources as method members (not class members) ?

* if I can instantiate the EntityManager inside the manager is
enough.. than I can refactor the rest of the code to even remove the
need of EJBs ........
* preferably without lookups, I prefer the container to manage the
resources and not the code.. but ok if I am forced to...