Hi Timothy,

using the tasklist-blueprint-cdi example
(https://github.com/cschneider/Karaf-Tutorial/tree/master/tasklist-blueprint-cdi),
I have exchanged H2 by PostgreSQL, added an orm.xml, exchanged the
datasource configuration with one for a PostgreSQL DB, created a PostgreSQL
DB named tasklist and a schema named tasklist_schema. And it works.

Then I changed the name of the mapping file from orm.xml to
tasklist_orm.xml, and it started writing the tables to the public schema.

So the problem seems to be that with other mapping file names than orm.xml,
it doesnt work. My changes are attached below.

Regards,

Jochen

persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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="tasklist" transaction-type="JTA">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        
        
       
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=tasklist)</jta-data-source>
        
        
       
<non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=tasklist)</non-jta-data-source>
                <mapping-file>META-INF/orm.xml</mapping-file>
        <properties>
            <property name="hibernate.dialect"
value="org.hibernate.dialect.PostgreSQLDialect"/>
            <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
        </properties>
    </persistence-unit>

</persistence>



orm.xml:

<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm
orm_2_0.xsd"
    version="2.0">
    <persistence-unit-metadata>
        <persistence-unit-defaults>
            <schema>tasklist_schema</schema>
        </persistence-unit-defaults>
    </persistence-unit-metadata>
</entity-mappings>



org.ops4j.datasource-tasklist.cfg:

dataSourceName=tasklist
osgi.jdbc.driver.name = PostgreSQL JDBC Driver-pool-xa
serverName = localhost
portNumber = 5432
databaseName = tasklist
user = postgres
password = postgres



last but not least, a change in the features.xml: replace "pax-jdbc-h2" by
"pax-jdbc-postgresql"





--
View this message in context: 
http://karaf.922171.n3.nabble.com/Aries-JPA-2-3-0-mapping-file-not-used-tp4047501p4047569.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to