[ 
https://issues.apache.org/jira/browse/ARIES-1355?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14642086#comment-14642086
 ] 

Matt Pavlovich commented on ARIES-1355:
---------------------------------------

The main use case is to be able to support JTA and non-JTA data sources from 
the same bundle. I don't believe that those values can be simply injected using 
the Properties map.. see below:

PU #1: 
{noformat}
<persistence-unit name="pu.osgi.jta" transaction-type="JTA">
                
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
                
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jndi/ds.jta)</jta-data-source>
                <mapping-file>META-INF/orm.xml</mapping-file>
                <class>com.company.ClassToBeEnhanced</class>
                <exclude-unlisted-classes>true</exclude-unlisted-classes>
                <properties>
                         <property name="openjpa.TransactionMode" 
value="managed" />
                        <property name="org.apache.openjpa.ManagedRuntime" 
value="jndi(TransactionManagerName=osgi:service/javax.transaction.TransactionManager)"
 />
                          ....
               </properties>
</persistence-unit>
{noformat}

PU #2:
{noformat}
<persistence-unit name="pu.osgi" transaction-type="RESOURCE_LOCAL">
                
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
                
<non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jndi/ds)</non-jta-data-source>
                <mapping-file>META-INF/orm.xml</mapping-file>
                <class>com.company.ClassToBeEnhanced</class>
                <exclude-unlisted-classes>true</exclude-unlisted-classes>
                <properties>
                          ....
               </properties>
</persistence-unit>
{noformat}




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

Reply via email to