aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giuseppe Gerla <>
Subject Property placeholder in jpa Namespace
Date Mon, 02 Feb 2015 09:45:45 GMT
Hi all,
linked to my pull request #19 to fix ARIES-1023 and ARIES-1079, I'd like to
discuss with you another feature.
In my system I'm using spring-orm to create an EntityManagerFactory to be
injected into my data service. I use a persistence.xml with only classes
list and NO properties declared.
I use the spring file to define the jpa properties in this way

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
xmlns:xsi="" xmlns:context=""

<osgix:cm-properties id="dataSourceProperties"
<prop key="sensormix_db.driverClassName">org.hsqldb.jdbcDriver</prop>
<prop key="sensormix_db.url">jdbc:hsqldb:mem:sensormix_db</prop>
<prop key="sensormix_db.username">sa</prop>
<prop key="sensormix_db.password"></prop>
properties-ref="dataSourceProperties" />

<bean id="emf"
<property name="persistenceUnitName" value="sensormix_db" />
<property name="jpaVendorAdapter">
<property name="showSql" value="true" />
<property name="jpaProperties">
<prop key="eclipselink.ddl-generation">create-tables</prop>
<prop key="eclipselink.logging.level">INFO</prop>
<prop key="eclipselink.weaving">false</prop>
<prop key="javax.persistence.jdbc.url">${sensormix_db.url}</prop>
<prop key="javax.persistence.jdbc.user">${sensormix_db.username}</prop>
<prop key="javax.persistence.jdbc.password">${sensormix_db.password}</prop>

<!-- Beans of Test Application -->
<bean id="sensormixService"
<property name="entityManagerFactory" ref="emf" />


As you can see, some values are parameters that are set using the
property-placeholder. I think this is a very convenient way to manage the
dynamic change of jpa properties.

I try to do the same with Aries Jpa, in this way

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns=""
xmlns:jpa="" xmlns:xsi=""

<cm:property-placeholder persistent-id="sensormix.jpa.persistenceunit"
update-strategy="reload" >
<jpa:unit property="entityManagerFactory" unitname="sensormix_db" />
<jpa:context property="entityManager" unitname="sensormix_db">
<entry key="eclipselink.ddl-generation" value="create-tables" />
<entry key="eclipselink.logging.level" value="INFO" />
<entry key="javax.persistence.jdbc.driver"
value="${sensormix_db.driverClassName}" />
<entry key="javax.persistence.jdbc.url" value="${sensormix_db.url}" />
<entry key="javax.persistence.jdbc.user" value="${sensormix_db.username}" />
<entry key="javax.persistence.jdbc.password"
value="${sensormix_db.password}" />

but it seems that the NSHandler class is not able to resolve the parametric
value. I think this is because the properties map is in the jpa namespace.

Do you think that this is a new feature that we can add to Aries Jpa?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message