Re: Aries JPA 2.3.0: mapping file not used

2017-04-07 Thread Alex
I had the same issue too.

I have reported it on JIRA Apache Aries:  ARIES-1711
  

I hope this fix will be released as soo as possible. I added in the comments
the solution for a fix.



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


Re: Aries JPA 2.3.0: mapping file not used

2016-08-18 Thread Christian Schneider
You are right. I just checked in the 1.x jpa code for that. Here is how it
is done there:
https://github.com/apache/aries/blob/jpa-1.x/jpa-container/src/main/java/org/apache/aries/jpa/container/parsing/impl/JPAHandler.java#L101-L102

Christian


2016-08-18 11:40 GMT+02:00 Timothy Ward :

> That is exactly my point:
>
> https://github.com/apache/aries/blob/ebd8d1588b1a99d635bfc9c58fa72d
> 7da1222a3e/jpa/jpa-container/src/main/java/org/apache/
> aries/jpa/container/parser/impl/JPAHandler.java#L68
>
> Aries JPA makes no attempt to process the mapping file element(s) in the
> persistence xml file, so no information will be passed to the provider.
>
> Regards,
>
> Tim
>
> On 18 Aug 2016, at 09:19, jochenw  wrote:
>
> The behavior is the same with Eclipselink (I just haven't adapted the
> tasklist example to Eclipselink - which I use in my application). Might the
> ORMs look for the default file orm.xml, and only need some configuration
> input when the filename is different, which Aries JPA does not handle?
>
> Regards,
>
> Jochen
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.
> com/Aries-JPA-2-3-0-mapping-file-not-used-tp4047501p4047578.html
> Sent from the Karaf - User mailing list archive at Nabble.com
> .
>
>
>


-- 
-- 
Christian Schneider
http://www.liquid-reality.de


Open Source Architect
http://www.talend.com



Re: Aries JPA 2.3.0: mapping file not used

2016-08-18 Thread Timothy Ward
That is exactly my point:

https://github.com/apache/aries/blob/ebd8d1588b1a99d635bfc9c58fa72d7da1222a3e/jpa/jpa-container/src/main/java/org/apache/aries/jpa/container/parser/impl/JPAHandler.java#L68
 


Aries JPA makes no attempt to process the mapping file element(s) in the 
persistence xml file, so no information will be passed to the provider.

Regards,

Tim

> On 18 Aug 2016, at 09:19, jochenw  wrote:
> 
> The behavior is the same with Eclipselink (I just haven't adapted the
> tasklist example to Eclipselink - which I use in my application). Might the
> ORMs look for the default file orm.xml, and only need some configuration
> input when the filename is different, which Aries JPA does not handle?
> 
> Regards,
> 
> Jochen
> 
> 
> 
> --
> View this message in context: 
> http://karaf.922171.n3.nabble.com/Aries-JPA-2-3-0-mapping-file-not-used-tp4047501p4047578.html
> Sent from the Karaf - User mailing list archive at Nabble.com.



Re: Aries JPA 2.3.0: mapping file not used

2016-08-18 Thread jochenw
The behavior is the same with Eclipselink (I just haven't adapted the
tasklist example to Eclipselink - which I use in my application). Might the
ORMs look for the default file orm.xml, and only need some configuration
input when the filename is different, which Aries JPA does not handle?

Regards,

Jochen



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


Re: Aries JPA 2.3.0: mapping file not used

2016-08-17 Thread Tim Ward
The issue appears to be that Aries JPA has no code to handle the mapping files 
element of the persistence unit. As a result no mapping file names are passed 
to the JPA provider.

I think this is an Aries issue.

Tim

Sent from my iPhone

> On 17 Aug 2016, at 21:09, Christian Schneider  wrote:
> 
> 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 :
>> 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:
>> 
>> 
>> 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";>
>> 
>> 
>> org.hibernate.jpa.HibernatePersistenceProvider
>> 
>> 
>> 
>> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=tasklist)
>> 
>> 
>> 
>> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=tasklist)
>> META-INF/orm.xml
>> 
>> > value="org.hibernate.dialect.PostgreSQLDialect"/>
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> orm.xml:
>> 
>> 
>> 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">
>> 
>> 
>> tasklist_schema
>> 
>> 
>> 
>> 
>> 
>> 
>> 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
> 
> Open Source Architect
> http://www.talend.com


Re: Aries JPA 2.3.0: mapping file not used

2016-08-17 Thread Christian Schneider
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 :

> 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:
>
> 
> 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";>
>
> 
> org.hibernate.jpa.HibernatePersistenceProvider provider>
>
>
>
> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name
> =tasklist)
>
>
>
> osgi:service/javax.sql.DataSource/(
> osgi.jndi.service.name=tasklist)
> META-INF/orm.xml
> 
>  value="org.hibernate.dialect.PostgreSQLDialect"/>
> 
> 
> 
>
> 
>
>
>
> orm.xml:
>
> 
> 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">
> 
> 
> tasklist_schema
> 
> 
> 
>
>
>
> 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


Open Source Architect
http://www.talend.com



Re: Aries JPA 2.3.0: mapping file not used

2016-08-17 Thread Timothy Ward
Hi Jochen,

This will probably be occurring because the Persistence Provider is 
auto-detecting the resource when it is called META-INF/orm.xml. This should be 
overridable in the persistence.xml, but isn’t.

Regards,

Tim


> On 17 Aug 2016, at 15:06, jochenw  wrote:
> 
> 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:
> 
> 
> 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";>
> 
>
>org.hibernate.jpa.HibernatePersistenceProvider
> 
> 
> 
> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=tasklist)
> 
> 
> 
> osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=tasklist)
>   META-INF/orm.xml
>
> value="org.hibernate.dialect.PostgreSQLDialect"/>
>
>
>
> 
> 
> 
> 
> 
> orm.xml:
> 
> 
> 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">
>
>
>tasklist_schema
>
>
> 
> 
> 
> 
> 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.



Re: Aries JPA 2.3.0: mapping file not used

2016-08-17 Thread jochenw
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:


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";>


org.hibernate.jpa.HibernatePersistenceProvider


   
osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=tasklist)


   
osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=tasklist)
META-INF/orm.xml










orm.xml:


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">


tasklist_schema






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.


Re: Aries JPA 2.3.0: mapping file not used

2016-08-15 Thread Timothy Ward
There was a major rewrite of Aries JPA between version 1.x and 2.x. It appears 
as though the mapping file support was lost (I can find no reference to mapping 
files in the parser).

This is obviously something that needs to be fixed - is there any way that you 
can supply a simplified version of this as a test case?

Regards,

Tim

> On 12 Aug 2016, at 10:14, jochenw  wrote:
> 
> Sorry, forgot to mention that this happens with Karaf 4.0.4 and 4.0.5, and it
> is still the case when explicitly installing the JPA 2.4.0 features.
> 
> Regards,
> 
> Jochen
> 
> 
> 
> --
> View this message in context: 
> http://karaf.922171.n3.nabble.com/Aries-JPA-2-3-0-mapping-file-not-used-tp4047501p4047507.html
> Sent from the Karaf - User mailing list archive at Nabble.com.



Re: Aries JPA 2.3.0: mapping file not used

2016-08-12 Thread jochenw
Sorry, forgot to mention that this happens with Karaf 4.0.4 and 4.0.5, and it
is still the case when explicitly installing the JPA 2.4.0 features.

Regards,

Jochen



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


Aries JPA 2.3.0: mapping file not used

2016-08-11 Thread jochenw
Hello,

I have just switched from Aries JPA 1.0.4 to 2.3.0, used in combination with
EclipseLink 2.6.1. With a H2 database, it works smoothly, and much better
than with 1.0.4.

However, I also have a PostgreSQL database where I have organized tables in
several schemas. Typically I use a common datasource for the different
persistence bundles, and each persistence bundle has a mapping file orm.xml
to cope with the according schema:


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">


schema_one




In the persistence.xml, the mapping file is referenced with
META-INF/orm.xml

That mapping file seems not to work any longer. I receive some "relation xyz
does not exist" exception, and when switching on fine logging for
EclipseLink, it becomes obvious that the schema name is not used for
accessing the tables (just /SELECT  FROM MyTable/ instead of /SELECT
 FROM schema_one.MyTable/) .

Of course I could use something like
url=jdbc:postgresql://localhost:5432/mydb?currentSchema=schema_one when
defining the data source - but this way I would need one data source per
persistence bundle.

Is there something special I need to do to re-activate the orm.xml file?

Regards,
Jochen



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