perhaps I can get the EntityManager from the @Context ??
2009/5/20 Felipe Gaúcho <fgaucho_at_gmail.com>:
> 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...
>
--
Please help to test this application:
http://fgaucho.dyndns.org:8080/cejug-classifieds-richfaces