openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabio Martelli <>
Subject Configuring datasources working with Slice and Spring
Date Sat, 15 Dec 2012 09:47:40 GMT
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 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 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}"/>
    <property name="isolationLevelName" value="ISOLATION_READ_COMMITTED"/>
  <property name="jpaPropertyMap">
        <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"/>

Please, can someone help me with this issue?

Thank you in advance.
Best regards,

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