[
https://issues.apache.org/jira/browse/ARIES-1355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14640501#comment-14640501
]
Giuseppe Gerla commented on ARIES-1355:
---------------------------------------
Hi Matt
Christian is right.
If your porpouse is to use the same JPA implementation with different databases
vendor, you have to work with DataSource configuration.
In JPA 2 we implement also the functionality to set persistence properties
using ConfigAdmin OSGi service. Using this functionality you can change the JPA
implementation without change your code.
So, for example, if you set the unit name to my.pu using annotation, then you
can pass persistence properties declaring:
1. a PID called org.apache.aries.jpa.my.pu
2. eclipselink property
org.apache.aries.jpa.my.pu.eclipselink.ddl-generation = create-tables
or hibernate property
org.apache.aries.jpa.my.pu.hibernate.hbm2ddl.auto = create-drop
If you use Karaf/ServiceMix you have to create a file called
org.apache.aries.jpa.my.pu.cfg with following rows for eclipselink
eclipselink.ddl-generation = create-tables
or following for hibernate
hibernate.hbm2ddl.auto = create-drop
> blueprint-jpa does not interpolate configuration properties
> -----------------------------------------------------------
>
> Key: ARIES-1355
> URL: https://issues.apache.org/jira/browse/ARIES-1355
> Project: Aries
> Issue Type: Bug
> Components: Blueprint
> Affects Versions: blueprint-cm-1.0.6
> Reporter: Matt Pavlovich
>
> When attempting to wire in the persistent unit name from a cm property, aries
> jpa does not interpolate the value, and instead tries to lookup the ${name}
> literally.
> {noformat}
> <?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:camel="http://camel.apache.org/schema/blueprint"
> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
> xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0"
> xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.1.0"
> xsi:schemaLocation="
> http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
> <cm:property-placeholder persistent-id="com.company.jpatest">
> <cm:default-properties>
> <cm:property name="persistentUnitName" value="my.pu" />
> </cm:default-properties>
> </cm:property-placeholder>
> <bean id="tracingStoreTx" class="com.company.StuffJPAImpl"
> destroy-method="destroy">
> <jpa:unit unitname="${persistentUnitName}"
> property="entityManagerFactory" />
> </bean>
> ..
> {noformat}
> Log message
> {noformat}
> [(&(&(!(org.apache.aries.jpa.proxy.factory=*))(osgi.unit.name=${persistentUnitName}))(objectClass=javax.persistence.EntityManagerFactory)),
>
> (&(&(!(org.apache.aries.jpa.proxy.factory=*))(osgi.unit.name=${persistentUnitName}))(objectClass=javax.persistence.EntityManagerFactory))]
> java.util.concurrent.TimeoutException
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)