Hi All,
I'm working with Slice and Spring. 
I'd like to specify a different datasource per slice.

In particular, I'd like to have:
1. Spring datasource as <jta-data-source>  (connected to the 
distributed/virtual connection)
2. a different external (provided by the web container) datasource for each 
slice (including the master)

I tried following  https://issues.apache.org/jira/browse/OPENJPA-1643 without 
any success.

My current relevant configuration is the following.

Spring persistence context:
  ...
  <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="java:comp/env/jdbc/syncopeDataSource"/>
    <property name="defaultObject" ref="localDataSource"/>
  </bean>
  
  <bean id="localDataSource" 
class="org.springframework.jdbc.datasource.IsolationLevelDataSourceAdapter">
    <property name="targetDataSource">
      <bean class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="${jpa.driverClassName}"/>
        <property name="url" value="${jpa.url}"/>
        <property name="username" value="${jpa.username}"/>
        <property name="password" value="${jpa.password}"/>
      </bean>
    </property>
    <property name="isolationLevelName" value="ISOLATION_READ_COMMITTED"/>
  </bean>
  ...
  <property name="jpaPropertyMap">
      <map>
        <entry key="openjpa.slice.ROOT.ConnectionFactoryName" 
value="jdbc/root"/>
        <entry key="openjpa.slice.UsersFed.0.ConnectionFactoryName" 
value="jdbc/userfed0"/>
        <entry key="openjpa.slice.UsersFed.1.ConnectionFactoryName" 
value="jdbc/userfed1"/>
        <entry key="openjpa.slice.UsersFed.2.ConnectionFactoryName" 
value="jdbc/userfed2"/>
        <entry key="openjpa.slice.UsersFed.3.ConnectionFactoryName" 
value="jdbc/userfed3"/>
        <entry key="openjpa.slice.UsersFed.4.ConnectionFactoryName" 
value="jdbc/userfed4"/>
        ....
        </map>
  </property>
  ...

Please, can someone help me with this issue?

Thank you in advance.
Best regards,
F.


Reply via email to