users@jersey.java.net

Re: [Jersey] Jersey and JPA best practices?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 18 Dec 2008 17:39:15 +0100

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
>