Try these settings for openjpa and Derby.
https://github.com/cschneider/Karaf-Tutorial/blob/master/db/examplejpa/src/main/resources/META-INF/persistence.xml

Christian
Am 08.11.2014 22:24 schrieb "Jonathan Vila Lopez" <[email protected]>:

> Hello
>
> I dont know if this question is Karaf related or not, so sorry if I'm
> sending the question to the wrong place.
>
> I have a bundle with a persistence.xml, using OpenJPA and a H2 database (
> but I've tried also with Derby ).
>
> I think that whenever I install the bundle in Karaf and start it, openjpa
> would habe to create the tables in the database associated with the
> datasource.
>
> But the issue is that nothing happens in the database, and also I can not
> find any error in karaf log or in openjpa log ( I've set the log to a file
> ).
>
> This is my persistence file :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence";>
>   <persistence-unit name="persistencia" transaction-type="RESOURCE_LOCAL">
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>     <non-jta-data-source>osgi:service/javax.sql.DataSource/(
> osgi.jndi.service.name=jdbc/route-test-ds)</non-jta-data-source>
>   <class>com.tesipro.conectores.api.domain.ConectorLog</class>
>     <exclude-unlisted-classes>true</exclude-unlisted-classes>
>     <properties>
>         <property name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema(SchemaAction='add,deleteTableContents')"/>
>         <property name="openjpa.RuntimeUnenhancedClasses"
> value="supported" />
>         <property name="openjpa.Log"
> value="File=/home/jonathan/org.apache.openjpa.log, DefaultLevel=DEBUG,
> Runtime=DEBUG, Tool=DEBUG, SQL=TRACE"/>
>     </properties>
>   </persistence-unit>
> </persistence>
>
> And this is my blueprint file where I create the datasource :
>
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0";
>            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>   xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.3.0";
>            xsi:schemaLocation="
>        http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";>
>         <ext:property-placeholder />
>
>         <bean id="h2DataSource" class="org.h2.jdbcx.JdbcDataSource">
>             <property name="URL"
> value="jdbc:h2:${karaf.data}/database/h2Test" />
>             <property name="user" value="sa" />
>             <property name="password" value="" />
>         </bean>
>
>         <service id="dataSourceService" interface="javax.sql.DataSource"
> ref="h2DataSource">
>             <service-properties>
>                 <entry key="osgi.jndi.service.name"
> value="jdbc/route-test-ds" />
>             </service-properties>
>         </service>
> </blueprint>
>
> Any help why my tables are not created into the database ?
>
>
>
> [image: Inline image 2]
>
> * Jonathan Vila    ** <https://www.twitter.com/jonathan_vila>
> <http://www.linkedin.com/in/jonathanvila>*
>
> * [email protected] <[email protected]>*
>
>
>
>

Reply via email to