You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kodcanavari <ko...@gmail.com> on 2009/10/18 14:38:26 UTC

Jpa component, persistency.xml location

Hi,

Actually i'm developping camel routes under OSGi, so i create bundles and
deploy them onto a OSGi framework with camel-core bundles on it. Everything
is ok but:

I neet to use the JPA component in order to map an entity bean to the
database, but i don't know were to put the persistency.xml. Is there any way
to tell it by a programmatic way ? If not where can i put it?
-- 
View this message in context: http://www.nabble.com/Jpa-component%2C-persistency.xml-location-tp25946344p25946344.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Jpa component, persistency.xml location

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

You don't need to export he META-INF directory, as the openjpa bundle 
will find check the persistence.xml for your whether your bundle export 
the META-INF directory or not.

Please make sure you install a right version of openjpa bundle.
Mine is 
org.apache.servicemix.bundles/org.apache.servicemix.bundles.openjpa/1.2.1_1-SNAPSHOT

Willem

kodcanavari wrote:
> 
> i think my persistency.xml is never read because i got this error:
> 
> org.apache.camel.FailedToCreateProducerException: Failed to create Producer
> for endpoint:
> Endpoint[jpa://com.xxx.routecsvoracle.EntityBean?persistenceUnit=postgres].
> Reason: javax.persistence.PersistenceException: Found
> 'javax.persistence.provider' property in the map but the value is not a
> String. Found object : 'null'.
> 
> 
> OK, so how can i export the META-INF with bnd plugin?
> What is the good syntax for it? (i know it's forbidden by OSGi spec but i
> think, i don't have any other choice)
> 
> 
> Thanks.


Re: Jpa component, persistency.xml location

Posted by kodcanavari <ko...@gmail.com>.

i think my persistency.xml is never read because i got this error:

org.apache.camel.FailedToCreateProducerException: Failed to create Producer
for endpoint:
Endpoint[jpa://com.xxx.routecsvoracle.EntityBean?persistenceUnit=postgres].
Reason: javax.persistence.PersistenceException: Found
'javax.persistence.provider' property in the map but the value is not a
String. Found object : 'null'.


OK, so how can i export the META-INF with bnd plugin?
What is the good syntax for it? (i know it's forbidden by OSGi spec but i
think, i don't have any other choice)


Thanks.
-- 
View this message in context: http://www.nabble.com/Jpa-component%2C-persistency.xml-location-tp25946344p25967874.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Jpa component, persistency.xml location

Posted by Willem Jiang <wi...@gmail.com>.
Hi,

You just need to put the persistency.xml into your bundle's META-INF 
directory (your bundle also need to export this META-INF package), and 
the servicemix-jpa bundle will find this file automatically.

Willem

kodcanavari wrote:
> Hi,
> 
> Actually i'm developping camel routes under OSGi, so i create bundles and
> deploy them onto a OSGi framework with camel-core bundles on it. Everything
> is ok but:
> 
> I neet to use the JPA component in order to map an entity bean to the
> database, but i don't know were to put the persistency.xml. Is there any way
> to tell it by a programmatic way ? If not where can i put it?


Re: Jpa component, persistency.xml location

Posted by Willem Jiang <wi...@gmail.com>.
Yes.
BTW, there is an OSGi unit test[1] which tests the openjpa and camel-jpa 
bundle.

[1] 
/Users/jiangning/Work/camel/trunk/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jpa/JpaRouteTest.java

Willem


kodcanavari wrote:
> Thanks Willem for your response;
> 
> As i'm not on ServiceMix, but i'm directly on a Felix, i don't have
> servicemix-jpa bundle.
> So i searched the servicemix sources a littlebit and i found the openjpa,
> when i looked its code it implements SynchronousBundleListener  which means
> it listens for every bundle coming on the framework and reads its
> META-INF/persistency.xml. 
> 
> So if i just deploy openjpa, you think it's going to work and i will have my
> jpa config ready to use by camel jpa endpoint?
> 
> 
> 
> 
> 
> 
> kodcanavari wrote:
>> Hi,
>>
>> Actually i'm developping camel routes under OSGi, so i create bundles and
>> deploy them onto a OSGi framework with camel-core bundles on it.
>> Everything is ok but:
>>
>> I neet to use the JPA component in order to map an entity bean to the
>> database, but i don't know were to put the persistency.xml. Is there any
>> way to tell it by a programmatic way ? If not where can i put it?
>>
>> Thanks.
>>
> 


Re: Jpa component, persistency.xml location

Posted by kodcanavari <ko...@gmail.com>.
Thanks Willem for your response;

As i'm not on ServiceMix, but i'm directly on a Felix, i don't have
servicemix-jpa bundle.
So i searched the servicemix sources a littlebit and i found the openjpa,
when i looked its code it implements SynchronousBundleListener  which means
it listens for every bundle coming on the framework and reads its
META-INF/persistency.xml. 

So if i just deploy openjpa, you think it's going to work and i will have my
jpa config ready to use by camel jpa endpoint?






kodcanavari wrote:
> 
> Hi,
> 
> Actually i'm developping camel routes under OSGi, so i create bundles and
> deploy them onto a OSGi framework with camel-core bundles on it.
> Everything is ok but:
> 
> I neet to use the JPA component in order to map an entity bean to the
> database, but i don't know were to put the persistency.xml. Is there any
> way to tell it by a programmatic way ? If not where can i put it?
> 
> Thanks.
> 

-- 
View this message in context: http://www.nabble.com/Jpa-component%2C-persistency.xml-location-tp25946344p25951702.html
Sent from the Camel - Users mailing list archive at Nabble.com.