users@jersey.java.net

Re: [Jersey] Jersey and JPA best practices?

From: Luis Arias <kaaloo_at_gmail.com>
Date: Thu, 18 Dec 2008 17:57:58 +0100

Thanks for the code, I still have to go through this since I'm still
learning, I would have to get a better understanding of the generic
IOC spi. In my case I now think there will be no particular issues
since both frameworks are basically living side by side. The
application is actually a device controller for which I wish to expose
a RESTful interface for the web UI. The device protocol (firmware)
cannot multiplex commands, so I'm putting all access to the devices on
a quartz scheduler. The quartz jobs may interact with JPA and the
device control service. The app would either have to poll a resource
with GET to notice when changes actually took place or I also wanted
to take a look at Grizzly comet to try to push a notification to the
web app, but I'm not there yet ! Of course, I'm probably missing out
on some advantages of a tighter guice / jersey integration. Oh and
I'm using guice 1.0.

Luis

On Thu, Dec 18, 2008 at 5:39 PM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
> See here:
>
> https://jersey.dev.java.net/issues/show_bug.cgi?id=163
>
> for some proposed Guice code, which currently depends on the trunk IIRC.
>
> What version of Guice are you using? How are you integrating with Jersey?
>
> Paul.
>
> On Dec 18, 2008, at 5:21 PM, Luis Arias wrote:
>
>> Hmm, I'm currently attempting to use guice + warp-persist + JPA +
>> Jersey because I started out with guice in a sub project. Any
>> blocking issues I may come across as I move forward that would incite
>> me to move to Spring instead ? I have read that there is some work
>> for deeper guice / jersey integration but I'm not aware of what the
>> consequences of that would be for my application of not benefiting
>> from that in the current version.
>>
>> Luis
>>
>> On Thu, Dec 18, 2008 at 3:45 PM, Paul Sandoz <Paul.Sandoz_at_sun.com> wrote:
>>>
>>> On Dec 18, 2008, at 11:54 AM, Julio Faerman wrote:
>>>
>>>> Well, i am using Jersey + JPA + Spring, so the EntityManager gets
>>>> injected using the @PersistenceContext annotation.
>>>> Works fine for me.
>>>>
>>>
>>> +1
>>>
>>> Such best practices will also become clearer for Java EE 6. Namely you
>>> will
>>> be able to:
>>>
>>> 1) Use session beans as resource classes; or
>>>
>>> 2) Inject stuff onto a resource classes like you can do for a Servlet.
>>>
>>>
>>> We do have some basic form of persistence support with resource classes
>>> to
>>> allow the injection of an EntityManagerFactory, see the bookmark example:
>>>
>>>
>>> http://download.java.net/maven/2/com/sun/jersey/samples/bookmark/1.0.1/bookmark-1.0.1-project.zip
>>>
>>> but i think the Jersey + JPA + Spring is a more complete solution.
>>>
>>> Paul.
>>>
>>>> On Thu, Dec 18, 2008 at 7:46 AM, Florian Hars <hars_at_bik-gmbh.de> wrote:
>>>>>
>>>>> What is the best way to use jersey with JPA?
>>>>>
>>>>> I found most of the necessary magic incantations (like the
>>>>> WEB-INF/classes/META-INF/persistence.xml madness and telling glassfish
>>>>> not to throw "java.lang.AbstractMethodError:
>>>>>
>>>>>
>>>>> org.postgresql.jdbc3.Jdbc3Connection.getClientInfo()Ljava/util/Properties"
>>>>> by setting JDBC30DataSource to true in the properties of the pool) and
>>>>> now I
>>>>> can ask Persistence to give me an EntityManagerFactory and it will do
>>>>> so.
>>>>>
>>>>> But what is the best way to manage these ManagerFactories and their
>>>>> assorted
>>>>> Managers? I can't seem to find the right set of annotations to get
>>>>> container managed persistence to work, do I have to write my own
>>>>> EntityManagerFactoryManager?
>>>>>
>>>>> Any hints/tips/experiences?
>>>>>
>>>>> - Florian.
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>>
>>
>>
>>
>> --
>> Luis Arias
>> +33 6 14 20 87 93
>> skype : kaaloo
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>



-- 
Luis Arias
+33 6 14 20 87 93
skype : kaaloo