Re: AW: Problem joining two tables with same column name

2006-03-13 Thread Josef Wagner
Hi Jakob,

do you think that I have the same problem?
It appears only with m-n.

##
### 1. mapping ###
##
  !-- m - n --
  collection-descriptor
 name=table_n
 
collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList

 element-class-ref=de.on_ergy.lakon.data.model.TableN
 auto-retrieve=true
 auto-update=object
 auto-delete=link
 proxy=true
 indirection-table=table_m_table_n
  
 fk-pointing-to-this-class column=table_m_obj_id/
 fk-pointing-to-element-class column=table_n_obj_id/
  /collection-descriptor

#
### 2. javacode for query ###
#

crit.addEqualTo(table_n.obj_id, 1);

#
### 3. ojb sql output ###
#
SELECT A0.obj_id,
FROM table_m A0 
LEFT OUTER JOIN 
(
table_m_table_n A1 LEFT OUTER JOIN table_n A2 
ON A1.table_n_obj_id=A2.obj_id
) 
ON A0.obj_id=A1.table_m_obj_id 
WHERE obj_id = 1


##
### 4. the bug ###
##
Now, the problem is the incorrect obj_id without A2 as prefix :o(.
So, I get the following logical exception:
org.postgresql.util.PSQLException: ERROR: column reference obj_id is
ambiguous


Thanks a lot!

Josef Wagner



 Original-Nachricht 
Betreff:Re: AW: Problem joining two tables with same column name
Datum:  Fri, 03 Mar 2006 19:03:50 +0100
Von:Jakob Braeuchi [EMAIL PROTECTED]
Antwort an: OJB Users List ojb-user@db.apache.org
An: OJB Users List ojb-user@db.apache.org, [EMAIL PROTECTED]
Referenzen: 
[EMAIL PROTECTED]



hi markus,

ojb 1.0.5 should be released this month.

you should always use 'attributes' not 'columns' in your queries and let 
ojb translate the attribut-name into a column-name.

hth
jakob

ps: what do you use ojb for in bedag ?


Lauber Markus, Bedag schrieb:
 Hi Jakob
 
 Thank you for the explanation. When will OJB 1.0.5 be released? 
 
 What do you suggest, is it better to use the method addEqualTo() or
 addColumnEqualTo() in a project? In our project we used both methods and
 we want to refactor our code.
 
 Greetings
 Markus 
 
 
 
 
 
 No virus found in this incoming message.
 Checked by AVG Free Edition.
 Version: 7.1.375 / Virus Database: 268.1.2/274 - Release Date: 03.03.2006

-
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]



Re: AW: Problem joining two tables with same column name

2006-03-13 Thread Jakob Braeuchi

hi josef,

you should not prefix the attribute with the tablename.
crit.addEqualTo(id) is ok, where id is the name of the attribute not 
the name of the column.


hth
jakob

Josef Wagner schrieb:

Hi Jakob,

do you think that I have the same problem?
It appears only with m-n.

##
### 1. mapping ###
##
  !-- m - n --
  collection-descriptor
 name=table_n
 
collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList


 element-class-ref=de.on_ergy.lakon.data.model.TableN
 auto-retrieve=true
 auto-update=object
 auto-delete=link
 proxy=true
 indirection-table=table_m_table_n
  
 fk-pointing-to-this-class column=table_m_obj_id/
 fk-pointing-to-element-class column=table_n_obj_id/
  /collection-descriptor

#
### 2. javacode for query ###
#

crit.addEqualTo(table_n.obj_id, 1);

#
### 3. ojb sql output ###
#
SELECT A0.obj_id,
FROM table_m A0 
LEFT OUTER JOIN 
(
table_m_table_n A1 LEFT OUTER JOIN table_n A2 
ON A1.table_n_obj_id=A2.obj_id
) 
ON A0.obj_id=A1.table_m_obj_id 
WHERE obj_id = 1



##
### 4. the bug ###
##
Now, the problem is the incorrect obj_id without A2 as prefix :o(.
So, I get the following logical exception:
org.postgresql.util.PSQLException: ERROR: column reference obj_id is
ambiguous


Thanks a lot!

Josef Wagner



 Original-Nachricht 
Betreff:Re: AW: Problem joining two tables with same column name
Datum:  Fri, 03 Mar 2006 19:03:50 +0100
Von:Jakob Braeuchi [EMAIL PROTECTED]
Antwort an: OJB Users List ojb-user@db.apache.org
An: OJB Users List ojb-user@db.apache.org, [EMAIL PROTECTED]
Referenzen: 
[EMAIL PROTECTED]




hi markus,

ojb 1.0.5 should be released this month.

you should always use 'attributes' not 'columns' in your queries and let 
ojb translate the attribut-name into a column-name.


hth
jakob

ps: what do you use ojb for in bedag ?


Lauber Markus, Bedag schrieb:


Hi Jakob

Thank you for the explanation. When will OJB 1.0.5 be released? 


What do you suggest, is it better to use the method addEqualTo() or
addColumnEqualTo() in a project? In our project we used both methods and
we want to refactor our code.

Greetings
Markus 






No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.2/274 - Release Date: 03.03.2006



-
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]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: AW: Problem joining two tables with same column name

2006-03-13 Thread Josef Wagner
Thanks a lot Jakob!
That was the problem


-Ursprüngliche Nachricht-
Von: Jakob Braeuchi [mailto:[EMAIL PROTECTED] 
Gesendet: Montag, 13. März 2006 18:09
An: OJB Users List
Betreff: Re: AW: Problem joining two tables with same column name

hi josef,

you should not prefix the attribute with the tablename.
crit.addEqualTo(id) is ok, where id is the name of the attribute not 
the name of the column.

hth
jakob

Josef Wagner schrieb:
 Hi Jakob,
 
 do you think that I have the same problem?
 It appears only with m-n.
 
 ##
 ### 1. mapping ###
 ##
   !-- m - n --
   collection-descriptor
  name=table_n
  

collection-class=org.apache.ojb.broker.util.collections.ManageableArrayList
 
  element-class-ref=de.on_ergy.lakon.data.model.TableN
  auto-retrieve=true
  auto-update=object
  auto-delete=link
  proxy=true
  indirection-table=table_m_table_n
   
  fk-pointing-to-this-class column=table_m_obj_id/
  fk-pointing-to-element-class column=table_n_obj_id/
   /collection-descriptor
 
 #
 ### 2. javacode for query ###
 #
 
 crit.addEqualTo(table_n.obj_id, 1);
 
 #
 ### 3. ojb sql output ###
 #
 SELECT A0.obj_id,
 FROM table_m A0 
 LEFT OUTER JOIN 
 (
 table_m_table_n A1 LEFT OUTER JOIN table_n A2 
 ON A1.table_n_obj_id=A2.obj_id
 ) 
 ON A0.obj_id=A1.table_m_obj_id 
 WHERE obj_id = 1
 
 
 ##
 ### 4. the bug ###
 ##
 Now, the problem is the incorrect obj_id without A2 as prefix :o(.
 So, I get the following logical exception:
 org.postgresql.util.PSQLException: ERROR: column reference obj_id is
 ambiguous
 
 
 Thanks a lot!
 
 Josef Wagner
 
 
 
  Original-Nachricht 
 Betreff:  Re: AW: Problem joining two tables with same column name
 Datum:Fri, 03 Mar 2006 19:03:50 +0100
 Von:  Jakob Braeuchi [EMAIL PROTECTED]
 Antwort an:   OJB Users List ojb-user@db.apache.org
 An:   OJB Users List ojb-user@db.apache.org, [EMAIL PROTECTED]
 Referenzen: 
 [EMAIL PROTECTED]
 
 
 
 hi markus,
 
 ojb 1.0.5 should be released this month.
 
 you should always use 'attributes' not 'columns' in your queries and let 
 ojb translate the attribut-name into a column-name.
 
 hth
 jakob
 
 ps: what do you use ojb for in bedag ?
 
 
 Lauber Markus, Bedag schrieb:
 
Hi Jakob

Thank you for the explanation. When will OJB 1.0.5 be released? 

What do you suggest, is it better to use the method addEqualTo() or
addColumnEqualTo() in a project? In our project we used both methods and
we want to refactor our code.

Greetings
Markus 





No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.2/274 - Release Date: 03.03.2006
 
 
 -
 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]
 
 

-
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]



AW: Problem joining two tables with same column name

2006-03-03 Thread Lauber Markus, Bedag
Hi Jakob

Your last tip (use addEqualto() instead of addColumnEqualTo()) solved my
problem. 

Thank you very much for your help.

Cheers 
Markus



AW: Problem joining two tables with same column name

2006-03-03 Thread Lauber Markus, Bedag
Hi Jakob

Thank you for the explanation. When will OJB 1.0.5 be released? 

What do you suggest, is it better to use the method addEqualTo() or
addColumnEqualTo() in a project? In our project we used both methods and
we want to refactor our code.

Greetings
Markus 


Re: AW: Problem joining two tables with same column name

2006-03-03 Thread Jakob Braeuchi

hi markus,

ojb 1.0.5 should be released this month.

you should always use 'attributes' not 'columns' in your queries and let 
ojb translate the attribut-name into a column-name.


hth
jakob

ps: what do you use ojb for in bedag ?


Lauber Markus, Bedag schrieb:

Hi Jakob

Thank you for the explanation. When will OJB 1.0.5 be released? 


What do you suggest, is it better to use the method addEqualTo() or
addColumnEqualTo() in a project? In our project we used both methods and
we want to refactor our code.

Greetings
Markus 






No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.2/274 - Release Date: 03.03.2006


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: AW: Problem joining two tables with same column name

2006-03-02 Thread Jakob Braeuchi

hi markus,

imo the problem is addColumnEqualTo(). in the column-methods the 
translation flag is false, which means that ojb does not try to 
translate the attribute-name into a column-name (that's ok for columns).


but we also do not prefix the column-name with the alias, and this looks 
like a bug :(


i'll fix it for 1.0.5.

jakob

Lauber Markus, Bedag schrieb:

Hi Jakob

I switched to the new version of OJB (1.0.4). But the new release
brought no improvement in the generation of the SQL statement. It still
has no alias prefixes for the first table in the where clause. 


 SELECT A0.COLUMN1,A0.COLUMN2,A0.COLUMN3,A0.COLUMN4
 FROM T1 A0,T2 A1 WHERE A0.ID=A1.T1ID AND (( (COLUMN1 = '034') AND
COLUMN2 = '78777') AND  (A1.DATE = '1900-12-12 12:00:00.0'))

Greetings
Markus






No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01.03.2006


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Problem joining two tables with same column name

2006-03-01 Thread Lauber Markus, Bedag
Hi Jakob

I switched to the new version of OJB (1.0.4). But the new release
brought no improvement in the generation of the SQL statement. It still
has no alias prefixes for the first table in the where clause. 

 SELECT A0.COLUMN1,A0.COLUMN2,A0.COLUMN3,A0.COLUMN4
 FROM T1 A0,T2 A1 WHERE A0.ID=A1.T1ID AND (( (COLUMN1 = '034') AND
COLUMN2 = '78777') AND  (A1.DATE = '1900-12-12 12:00:00.0'))

Greetings
Markus



Re: AW: Problem joining two tables with same column name

2006-03-01 Thread Jakob Braeuchi

hi markus,

do you have this problem on a 1:1 or 1:n relationship ?
could you eventually provide a test case ?

jakob

Lauber Markus, Bedag schrieb:

Hi Jakob

I switched to the new version of OJB (1.0.4). But the new release
brought no improvement in the generation of the SQL statement. It still
has no alias prefixes for the first table in the where clause. 


 SELECT A0.COLUMN1,A0.COLUMN2,A0.COLUMN3,A0.COLUMN4
 FROM T1 A0,T2 A1 WHERE A0.ID=A1.T1ID AND (( (COLUMN1 = '034') AND
COLUMN2 = '78777') AND  (A1.DATE = '1900-12-12 12:00:00.0'))

Greetings
Markus






No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01.03.2006


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: AW: Problem joining two tables with same column name

2006-03-01 Thread Jakob Braeuchi

hi markus,

in your original post i saw that you use addColumnEqualTo

// c.setAlias(a1);
c.addColumnEqualTo(COLUMN1,034);
c.addColumnEqualTo(COLUMN2,78777);
// Criteria c2 = new Criteria();

what's the reason no to use addEqualTo() ?

jakob

Lauber Markus, Bedag schrieb:

Hi Jakob

I switched to the new version of OJB (1.0.4). But the new release
brought no improvement in the generation of the SQL statement. It still
has no alias prefixes for the first table in the where clause. 


 SELECT A0.COLUMN1,A0.COLUMN2,A0.COLUMN3,A0.COLUMN4
 FROM T1 A0,T2 A1 WHERE A0.ID=A1.T1ID AND (( (COLUMN1 = '034') AND
COLUMN2 = '78777') AND  (A1.DATE = '1900-12-12 12:00:00.0'))

Greetings
Markus






No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 268.1.1/272 - Release Date: 01.03.2006


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]