I used version 3.3.2.GA available in Karaf 3.0.0.

I have also tested version 4.2.7 found here :
https://github.com/lburgazzoli/lb-karaf-features/blob/master/repo/hibernate4.xml

I have finally managed to make this version work. Indeed I found in a hibernate 
tutorial (see last comment in 
https://github.com/hibernate/hibernate-orm/blob/4.2/documentation/src/main/docbook/quickstart/tutorials/osgi/managed-jpa/features.xml)
 that hibernate-osgi must be started after the bundle containing JPA entities.
So to make everything work,  I have to stop the "hibernate-osgi" bundle before 
installing my bundle, and then restart "hibernate-osgi".
For instance :
> feature:install hibernate42
> stop 127 // NB: 127 is hibernate-osgi bundle
> install url_to_my_bundle
> start 127

This is somewhat dirty, I hope we can find a better solution.

Regards,
--
Nicolas

-----Original Message-----
From: Jean-Baptiste Onofré [mailto:[email protected]] 
Sent: mercredi 15 janvier 2014 15:02
To: [email protected]
Subject: Re: JPA with Karaf

Hi Nicolas,

thanks for the update.

What's version of the hibernate feature do you use ?

Regards
JB

On 01/15/2014 02:53 PM, Dutertry Nicolas wrote:
> The "hibernate" feature seems to be broken as well. I tried it and got a 
> "GracePeriod" state with the same log message :
> Bundle test.jpa is waiting for dependencies 
> [(&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=test))(o
> bjectClass=javax.persistence.EntityManagerFactory))]
>
> Regards
> --
> Nicolas
> -----Original Message-----
> From: Jean-Baptiste Onofré [mailto:[email protected]]
> Sent: mercredi 15 janvier 2014 06:46
> To: [email protected]
> Subject: Re: JPA with Karaf
>
> By the way, reviewing the OpenJPA feature, we found that the problem is in 
> the feature itself. We fix both OpenJPA 2.2.2 and 2.3.0 features for the next 
> Karaf release.
>
> Sorry about that.
>
> Regards
> JB
>
> On 01/14/2014 10:33 AM, Dutertry Nicolas wrote:
>> Hi,
>>
>> I am trying to use JPA with Karaf 3.0.0 but it does not work.
>>
>> First of all I have installed the following features :
>>
>> karaf@root()> feature:install jndi jpa transaction openjpa
>>
>> Then I have created a simple JPA bundle containing:
>>
>> -A HSQLDB datasource configured with blueprint
>>
>> -A JPA entity (class Person) and the file META-INF/persistence.xml
>>
>> -A service for getting and creating people (class PersonService)
>>
>> The JPA EntityManager is injected in PersonService using blueprint.
>>
>> Finally I have deployed hsqldb and my bundle in Karaf, but my 
>> bundle's state is set to "GracePeriod" :
>>
>> karaf@root()> list
>>
>> START LEVEL 100 , List Threshold: 50
>>
>> ID | State       | Lvl | Version        | Name
>>
>> ---------------------------------------------------------------------
>> -
>> ---------------------------
>>
>> 86 | Active      |  80 | 3.0.0          | Apache Karaf :: JNDI :: Command
>>
>> 114 | Active      |  80 | 2.3.0          | Apache ServiceMix :: Specs ::
>> Java Persistence API 1.4
>>
>> 115 | Active      |  80 | 3.2.1          | Commons Collections
>>
>> 116 | Active      |  80 | 1.6.0          | Commons Pool
>>
>> 117 | Active      |  80 | 1.4            | Commons DBCP
>>
>> 118 | Active      |  80 | 2.6            | Commons Lang
>>
>> 119 | Active      |  80 | 2.3.0          | OpenJPA Aggregate Jar
>>
>> 120 | Active      |  80 | 2.3.1          | HSQLDB
>>
>> 121 | GracePeriod |  80 | 1.0.0.SNAPSHOT | Test JPA OSGi Bundle
>>
>> In the log file we found :
>>
>> 2014-01-14 10:04:28,388 | INFO  | raf-3.0.0/deploy |
>> BlueprintContainerImpl           | 4 - org.apache.aries.blueprint.core -
>> 1.3.0 | Bundle test.jpa is waiting for dependencies 
>> [(&(&(org.apache.aries.jpa.proxy.factory=true)(osgi.unit.name=test))(
>> o bjectClass=javax.persistence.EntityManagerFactory))]
>>
>> I have attached the sources of my bundle and the full karaf log file 
>> in this mail.
>>
>> Is there a bug in Karaf or am I missing something ?
>>
>> Thanks for your help.
>>
>> --
>> Nicolas Dutertry
>> HR Access - http://www.hraccess.com
>>
>
> --
> Jean-Baptiste Onofré
> [email protected]
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to