openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaidge <>
Subject Re: Slice Error with simple query ( Websphere 7.0 & DB2 9.1 )
Date Fri, 27 Mar 2009 15:39:18 GMT

Can't I use slice framework with databases which not have the same structure ?

I have two database with different information and I must to use all these information ...

How can I make query accross slices ? or accross the two database using openjpa ?

Thanks M. Poddar

  You can target the query that has Userdb1 to slice ONE only. 

   Slice, in general, considers that the schema in every slice is identical. 


I used Websphere 7.0 ( openjpa 1.2.1 snapshot ) and DB2 UBD 9.1

I want to configure slice describe as follow ( persistence.xml )

 <persistence-unit name="persistenceUnit">

                        <property name="openjpa.BrokerFactory" value="slice" />
                        <property name="openjpa.slice.Names"   value="ONE,TWO"/>
                        <property name="openjpa.slice.Master"  value="ONE"/>
                        <property name="openjpa.slice.Lenient" value="true"/>
                        <property name="openjpa.ConnectionDriverName" value=""
                        <property name="openjpa.ConnectionURL" value="jdbc:db2://localhost:52000/DB1"/>
                        <property name="openjpa.ConnectionUserName" value="db2admin"/>
                        <property name="openjpa.ConnectionPassword" value="db2admin,001"

                        <property name="openjpa.slice.ONE.ConnectionDriverName" value=""
                        <property name="openjpa.slice.ONE.ConnectionURL" value="jdbc:db2://localhost:52000/DB1"/>
                        <property name="openjpa.slice.ONE.ConnectionUserName" value="db2admin"/>
                        <property name="openjpa.slice.ONE.ConnectionPassword" value="db2admin,001"
                <property name="openjpa.slice.TWO.ConnectionDriverName" value=""
                <property name="openjpa.slice.TWO.ConnectionURL" value="jdbc:db2://localhost:52000/DB2"/>
                <property name="openjpa.slice.TWO.ConnectionUserName" value="db2admin"/>
                <property name="openjpa.slice.TWO.ConnectionPassword" value="db2admin,001"
                <property name="openjpa.slice.DistributionPolicy" value="org.apache.openjpa.slice.policy.MyUserDistributionPolicy"/>
                <property name="openjpa.Log" value="SQL=TRACE"/>

I want to use 2 several databases. For testing I build a simple database structure with one
table in each database. Each database is connected to a slice so, Userdb1 is in slice one
and Customerdb2 is in slice two.

When I try to make a simple SELECT udb1.udb1Id, udb1.udb1Name, udb1.udb1Mail FROM Userdb1
udb1, I have this error :  DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, ...

Slice want to find Userdb1 in slice TWO but this table is in slice ONE only...

How I can do solve this problem ?

Best regards :) 

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message