Thomas --
You need to set the schema attribute on the class-descriptors.
Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]
>
> From: "Thomas Fahrmeyer" <[EMAIL PROTECTED]>
> Date: 2003/03/26 Wed AM 04:02:46 EST
> To: <[EMAIL PROTECTED]>
> Subject: Fields are merged if two DB connections are used
>
> I have a problem. I try to connect to two different databases (oracle
> and mysql) and want to retrieve data from
> a table that is given in both of them. Although the table has the same
> name in both databases, there are
> different fields. Contrary to sanity the generated query for one table
> does use the columns of both tables.
>
> Java Code:
> PersistenceBroker broker = getBroker("database1");
>
> UTable1 utable1 = new UTable1();
>
> Collection coll =
> broker.getCollectionByQuery(QueryFactory.newQuery(utable1)); // Here is
> the wrong query because fields of both tables have merged
>
> Iterator iter = coll.iterator();
> while(iter.hasNext()) {
> UTable1 ut1 = (UTable1)iter.next();
> cat.debug("UTable1: " + ut1.getName());
> }
> broker.close();
>
>
>
> broker = getBroker("database2");
>
> UTable2 utable2 = new UTable2();
>
> coll = broker.getCollectionByQuery(QueryFactory.newQuery(utable2)); //
> Still a wrong query
>
> iter = coll.iterator();
> while(iter.hasNext()) {
> UTable2 ut2 = (UTable2)iter.next();
> System.out.println("UTable2: " + ut2.getName());
> }
> broker.close();
>
>
>
> repository_database1.xml:
> <class-descriptor
> class="UTable1"
> table="user">
>
> <!-- This field is not in the other user table -->
> <field-descriptor id="1"
> name="usId"
> column="us_id"
> jdbc-type="VARCHAR"
> nullable="false"
> primarykey="true"
> />
>
> <field-descriptor id="2"
> name="usName"
> column="us_name"
> jdbc-type="VARCHAR"
> />
> </class-descriptor>
>
>
>
>
> repository_database2.xml:
> <class-descriptor
> class="UTable2"
> table="user">
>
> <!-- This field is not in the other user table -->
> <field-descriptor id="1"
> name="usFields"
> column="us_fields"
> jdbc-type="VARCHAR"
> nullable="false"
> primarykey="true"
> />
>
> <field-descriptor id="2"
> name="usName"
> column="us_name"
> jdbc-type="VARCHAR"
> />
> </class-descriptor>
>
>
>
> user table in database1 does only have the fields us_id and us_name.
> user table in database2 does only have the fields us_fields and us_name.
>
>
>
>
>
> The generated query:
> SELECT A0.us_name,A0.us_id,A0.us_fields FROM user A0
>
> As you can see the fields have merged....WHY?
>
> BTW OJB is cool stuff and really worth to be used ;) Keep on working.
>
> Thanx in advance
> Thomas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]