db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Armin Waibel <arm...@apache.org>
Subject Re: BUG(?): 2 classes, same table name, different database
Date Wed, 17 Nov 2004 22:11:07 GMT
Hi Joose,

AFAIK all persistent object related mappings (in OJB metadata classes) 
based on class name not on table name, so your problem should not 
happen. Nevertheless seems it does.
Could you post more details, e.g. a code snip where the problem happens.

How could a test case for your problem look like?
- Obtain PB instance for db1 and store AdminImpl object, close this PB. 
- Then obtain PB instance for db2 and store an Admin object --> this fails.

regards,
Armin


Joose Vettenranta wrote:
> If this is a bug,  hope some developer knows how to fix this.
> 
> for now, I made this "glue" solution, I just add database in front of 
> every table name. like
> 
> db1_admin
> db2_admin
> 
> and then ojb doesn't mix up those data.
> 
> more information:
> 
> in db1:
> create table admin (
>  uid varchar(20) not null,
>  password varchar(20) not null,
> primary key(uid));
> 
> in db2:
> create table admin (
>  id serial,
>  login varchar(30) not null,
>  password varchar(30) not null,
>  email varchar(100),
> primary key(id));
> 
> so when trying to fetch admin from db2 it tries to take uid also and 
> SqlException happenens (see below)
> 
> Thanks,
> 
> Joose
> 
> 15.11.2004 kello 13:57, Joose Vettenranta kirjoitti:
> 
>  So, is this a bug in OJB?
> 
>>
>> So one software,
>> 2 database
>> 2 classes
>> 2 different kind of table, but they are both named same
>> => table <-> class mapping is not working
>>
>> - Joose
>>
>> 12.11.2004 kello 09:43, Joose Vettenranta kirjoitti:
>>
>>  I forgot to say, that I have different dbuser and different 
>> connection for both of dabases. And both connection is described with 
>> jdbc-connection-descriptor -element and using :
>>
>>>                         <object-cache 
>>> class="org.apache.ojb.broker.cache.ObjectCacheDefaultImpl">
>>>                                 <attribute attribute-name="timeout" 
>>> attribute-value="900"/>
>>>                                 <attribute attribute-name="autoSync" 
>>> attribute-value="true"/>
>>>                                 <attribute 
>>> attribute-name="cachingKeyType" attribute-value="1"/>
>>>                                 </object-cache>
>>>
>>> Thanks,
>>>
>>> Joose
>>>
>>> 12.11.2004 kello 09:33, Joose Vettenranta kirjoitti:
>>>
>>>  Hi,
>>>
>>>>
>>>> I have 2 databases, let's call them db1 and db2
>>>>
>>>> in db1 I have table called admin
>>>> in db2 I have also table called admin
>>>>
>>>> but they are not like each other, they have different kind of table 
>>>> structure.
>>>>
>>>> for db1 I have a class to access table admin, let's call it 
>>>> net.vettenranta.db1.AdminImpl;
>>>> for db2 I have a class to access table admin, let's call it 
>>>> net.vettanranta.db2.Admin;
>>>>
>>>> Now, here is the problem:
>>>>
>>>> when I try to get data from db2 it tries also get db1's fields (most 
>>>> likely same happens to db1 class, but have not tried yet) which 
>>>> causes error: Caused by: java.sql.SQLException: ERROR:  No such 
>>>> attribute a0.uid
>>>>
>>>> So, is it possible to tell ojb that "heyy, it's this db2.Admin 
>>>> reference you have to use from repository, not db1.AdminImpl"?
>>>>
>>>> Using ojb1.0.1
>>>>
>>>> Thanks, Joose
> 
> -- 
> "Always remember that you are unique, just like everyone else!"
> * http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message