users@jersey.java.net

Re: [Jersey] synchronized

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 20 May 2009 15:31:44 +0200

On May 20, 2009, at 9:53 AM, Felipe Gaścho wrote:

> perhaps I can get the EntityManager from the @Context ??
>

If you write your own injection provider (which i assume you are using
for EJBs) it may be possible.

Paul.


> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>