Hi,

i don't know if it has an incidence, but I export a javax.sql.XADatasource
instead of a javax.sql.Datasource while publishing my database then
reference it as an XADb in the jta-datasource section of my persistence.xml.

* Datasource export:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent/blob/master/net.osgiliath.samples/net.osgiliath.hello/net.osgiliath.hello.model/net.osgiliath.hello.model.database/src/main/resources/OSGI-INF/blueprint/database.osgi-context.xml

* JPA/JTA sample (follow readme.md links):
https://github.com/OsgiliathEnterprise/net.osgiliath.parent/tree/master/net.osgiliath.samples/net.osgiliath.hello/net.osgiliath.hello.model/net.osgiliath.hello.model.jpa


Regards,



2014-07-11 9:40 GMT+02:00 jimmy <[email protected]>:

> Hi,
>
> Thanks for the response but yes i've done it
>
> here is my blueprint file
> <service
>         interface="com.inovelan.cloud.authentication.api.OpenAmService">
>         <bean
> class="com.inovelan.cloud.authentication.impl.OpenAmServiceImpl">
>             <jpa:context unitname="cloud-authentication-impl"
> property="entityManager" />
>             <tx:transaction method="*" value="Required" />
>         </bean>
> </service>
>
> and my persistence file
> <persistence version="2.0"
>         xmlns="http://java.sun.com/xml/ns/persistence";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>         xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";>
>         <persistence-unit name="cloud-authentication-impl"
>                 transaction-type="JTA">
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>
> <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name
> =jdbc/mysqlds)</jta-data-source>
>
> <class>com.inovelan.cloud.authentication.impl.entities.Utilisateur</class>
>                 <properties>
>                         <property name="openjpa.Log"
>                                 value="DefaultLevel=INFO, Runtime=TRACE,
>                 JDBC=TRACE" />
>                         <property
> name="openjpa.ConnectionFactoryProperties"
> value="PrettyPrint=true,PrintParameters=false" />
>                         <property name="openjpa.RuntimeUnenhancedClasses"
> value="supported" />
>                 </properties>
>         </persistence-unit>
> </persistence>
>
>
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/JPA-JTA-tp4034133p4034152.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 
Charlie Mordant

Full OSGI/EE stack made with Karaf:
https://github.com/OsgiliathEnterprise/net.osgiliath.parent

Reply via email to