Hmmm .. interesting. We do not have code in Aries JPA that specifically handles mapping files (as far as I know). So I wonder if this maybe is an issue in hibernate.
Christian 2016-08-17 16:06 GMT+02:00 jochenw <[email protected]>: > 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. > -- -- Christian Schneider http://www.liquid-reality.de <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.liquid-reality.de> Open Source Architect http://www.talend.com <https://owa.talend.com/owa/redir.aspx?C=3aa4083e0c744ae1ba52bd062c5a7e46&URL=http%3a%2f%2fwww.talend.com>
