Hello, Jaidge

Could you post what your
org.apache.openjpa.slice.policy.MyUserDistributionPolicy class looks like?
That is the essential class that tells OpenJPA's slice plugin how to divvy
work up between the slices.  It's possible that a bug in this class might
have caused OpenJPA to refer to the wrong slice.

Best Regards,

Jody Grassel

On Fri, Mar 27, 2009 at 10:39 AM, jaidge <[email protected]> wrote:

>
> 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
>
>
>
>
> Hi,
>  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">
>
>
>  <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>
>                <class>com.ibm.openjpa.slice.test.db1.Userdb1</class>
>                <class>com.ibm.openjpa.slice.test.db2.Customerdb2</class>
>
>        <properties>
>
>                        <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="com.ibm.db2.jcc.DB2Driver" />
>                        <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="com.ibm.db2.jcc.DB2Driver" />
>                        <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="com.ibm.db2.jcc.DB2Driver" />
>                <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"/>
>
>                </properties>
>        </persistence-unit>
>
> 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:
> http://n2.nabble.com/Slice-Error-with-simple-query-%28-Websphere-7.0---DB2-9.1-%29-tp2544575p2544909.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>
>

Reply via email to