You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Terry Brick <te...@yahoo.com> on 2003/12/15 16:25:19 UTC

OrderBy of ref class having same property name = problem

I have a class descriptor (CLASS_A) with a reference
to another (CLASS_B).  
Both CLASS_A and CLASS_B have a property called
"NAME".

-If I retrieve CLASS_A objects (using PB) with no
orderby, everything is fine.

-If I retrieve CLASS_A objects in the same manner, but
add a "CLASS_B_REF.SOME_OTHER_PROPERTY" orderby,
everything is fine.

-However, if I retrieve CLASS_A objects after adding a
"CLASS_B_REF.NAME" orderby, the NAME value from
CLASS_B gets populated in the NAME properties of
*both* the CLASS_A and CLASS_B objects!

In other words, if I add an orderby to my criteria and
that orderby is a referenced class with a property
name that exists in both the parent class and
referenced class, the referenced value is populated in
both the parent object and referenced object (they get
identical values).

So for example, in the database, it may look like
this.....
TABLE_A.NAME = "FOO"
TABLE_B.NAME = "BAR"

But in scenario described above, I get.....
CLASS_A.NAME = "BAR"
CLASS_B.NAME = "BAR

One other note, in my mappings, my classes are the
same name as my tables and properties same names as
the columns.... in case that has anything to do with
it.  If necessary, I'll try to provide an exact
example with real mappings, sql, etc. so someone can
try to reproduce the effect.  I've tried this on both
RC4 and RC5.  I'm using MySQL.

Any ideas?
Thanks!

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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


Re: OrderBy of ref class having same property name = problem

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi terry,

ojb always adds orderby or grouppby columns to the select columns if 
they are not already there. the only thing i did in my patch was adding 
an alias ojb_col_x to the automatically added columns.

the two columns in your sample are treatd as two *different* columns 
because the lookup in select columns is done simply by column name, so 
'bar' does not match 'foo as bar'. you'll have to use 
query.addOrderBy("foo as bar")

hth
jakob

Terry Brick wrote:
> Jakob,
> Thanks for fixing this.  It looks like the fix is possibly causing a problem in report queries. 
> Interestingly enough, I never even used report queries before today, but the cause of this problem
> definitely looks related to the alias solution.
> 
> If one of my columns in my report query has an alias and then that alias is used in an orderby or
> a groupby, then that alias is added to my column list as a column!
> 
> For example:
> query.setColumns("foo as bar");
> 
> -- work fine, unless I do something like following ---
> 
> query.addOrderBy("bar");
> 
> 
> -- or --
> 
> query.addGroupBy("bar");
> 
> If I do this OrderBy or GroupBy, with a column alias, it adds that alias to my select columns.. 
> The sql will come out something like...
> 
> select foo as bar, bar as obj_col1 from foos order by xxxxxx....
> 
> As you can see, "bar as obj_col1" is a problem....
> 
> 
> Thanks...
> 
> 
> --- Jakob Braeuchi <jb...@gmx.ch> wrote:
> 
>>hi terry,
>>
>>i checked in a quick fix using column alias.
>>
>>jakob
>>
>>Jakob Braeuchi wrote:
>>
>>
>>>hi terry,
>>>
>>>i can reproduce the problem and i posted it to the developer list:
>>>
>>> http://article.gmane.org/gmane.comp.jakarta.ojb.devel/4830   
>>>
>>>thanks for the testcase.
>>>jakob
>>>
> 
> 
> __________________________________
> Do you Yahoo!?
> Find out what made the Top Yahoo! Searches of 2003
> http://search.yahoo.com/top2003
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 


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


Re: OrderBy of ref class having same property name = problem

Posted by Terry Brick <te...@yahoo.com>.
Jakob,
Thanks for fixing this.  It looks like the fix is possibly causing a problem in report queries. 
Interestingly enough, I never even used report queries before today, but the cause of this problem
definitely looks related to the alias solution.

If one of my columns in my report query has an alias and then that alias is used in an orderby or
a groupby, then that alias is added to my column list as a column!

For example:
query.setColumns("foo as bar");

-- work fine, unless I do something like following ---

query.addOrderBy("bar");


-- or --

query.addGroupBy("bar");

If I do this OrderBy or GroupBy, with a column alias, it adds that alias to my select columns.. 
The sql will come out something like...

select foo as bar, bar as obj_col1 from foos order by xxxxxx....

As you can see, "bar as obj_col1" is a problem....


Thanks...


--- Jakob Braeuchi <jb...@gmx.ch> wrote:
> hi terry,
> 
> i checked in a quick fix using column alias.
> 
> jakob
> 
> Jakob Braeuchi wrote:
> 
> > hi terry,
> > 
> > i can reproduce the problem and i posted it to the developer list:
> > 
> >  http://article.gmane.org/gmane.comp.jakarta.ojb.devel/4830   
> > 
> > thanks for the testcase.
> > jakob
> > 

__________________________________
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003
http://search.yahoo.com/top2003

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


Re: OrderBy of ref class having same property name = problem

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi terry,

i checked in a quick fix using column alias.

jakob

Jakob Braeuchi wrote:

> hi terry,
> 
> i can reproduce the problem and i posted it to the developer list:
> 
>  http://article.gmane.org/gmane.comp.jakarta.ojb.devel/4830   
> 
> thanks for the testcase.
> jakob
> 
> Terry Brick wrote:
> 
>> Thanks Jakob for your interest... took me a while to get back
>> because I didn't see the response.  Anyway, I've included all info
>> necessary to reproduce the problem...
>> a) Table Structures
>> b) Repository
>> c) source code
>> d) SQL generated on my system
>> In the case below, the 'foo' property in 'table1' objects will
>> have values from the 'foo' property of 'table2'.
>>
>>
>> DDL
>> =========================================================
>> drop table table1;
>> #----------------------------
>> # Table structure for table1
>> #----------------------------
>> create table table1 (
>>    TABLE1_ID int(10) not null default '0',
>>    TABLE2_ID int(10) not null default '0',
>>    FOO varchar(10) not null,
>>    T1_COL varchar(10) not null,
>>    primary key (TABLE1_ID))
>>    type=MyISAM;
>>
>> #----------------------------
>> # Records for table table1
>> #----------------------------
>> insert  into table1 values (1, 1, 'T1_FOO_A', 'T1_A'), (2, 2, 
>> 'T1_FOO_B', 'T1_B');
>>
>> drop table table2;
>> #----------------------------
>> # Table structure for table2
>> #----------------------------
>> create table table2 (
>>    TABLE2_ID int(10) not null default '0',
>>    FOO varchar(10) not null,
>>    T2_COL varchar(10) not null,
>>    primary key (TABLE2_ID))
>>    type=MyISAM;
>>
>> #----------------------------
>> # Records for table table2
>> #----------------------------
>> insert  into table2 values (1, 'T2_FOO_A', 'T2_A'), (2, 'T2_FOO_B', 
>> 'T2_B');
>>
>>
>> Repository
>> ===============================================
>> <class-descriptor class="com.ibeque.epique.businessobjects.Table1" 
>> table="table1">
>>   <field-descriptor name="oid" column="TABLE1_ID" jdbc-type="BIGINT" 
>> primarykey="true"
>> autoincrement="true" required="true" length="5"/>
>>   <field-descriptor name="table2_id" column="TABLE2_ID" 
>> jdbc-type="BIGINT" required="true"
>> length="10"/>
>>   <field-descriptor name="foo" column="FOO" jdbc-type="VARCHAR" 
>> required="true" length="10"/>
>>   <field-descriptor name="t1_col" column="T1_COL" jdbc-type="VARCHAR" 
>> required="true"
>> length="10"/>
>>   <reference-descriptor name="table2_id_ref" 
>> class-ref="com.ibeque.epique.businessobjects.Table2"
>> auto-retrieve="false">
>>      <foreignkey field-ref="table2_id"/>
>>   </reference-descriptor>
>> </class-descriptor>
>>
>> <class-descriptor class="com.ibeque.epique.businessobjects.Table2" 
>> table="table2">
>>   <field-descriptor name="oid" column="TABLE2_ID" jdbc-type="BIGINT" 
>> primarykey="true"
>> autoincrement="true" required="true" length="5"/>
>>   <field-descriptor name="foo" column="FOO" jdbc-type="VARCHAR" 
>> required="true" length="10"/>
>>   <field-descriptor name="t2_col" column="T2_COL" jdbc-type="VARCHAR" 
>> required="true"
>> length="10"/>
>> </class-descriptor>
>>
>>
>> Source Code
>> =======================================================
>> Criteria criteria = new Criteria();
>> QueryByCriteria q = QueryFactory.newQuery(Table1.class, criteria);
>> q.addOrderBy("table2_id_ref.foo",true);
>> results = (List) broker.getCollectionByQuery(q);
>>
>>
>>
>>
>> Generated SQL
>> =======================================
>> SELECT     A0.T1_COL,
>>     A0.TABLE2_ID,
>>     A0.FOO,A0.TABLE1_ID,
>>     A1.FOO FROM     table1 A0 INNER JOIN     table2 A1 ON 
>>     A0.TABLE2_ID=A1.TABLE2_ID ORDER BY 5
>>
>>
>>
>>
>>
>>
>> --- Jakob Braeuchi <jb...@gmx.ch> wrote:
>>
>>> hi terry,
>>>
>>> please post the repository and the generated sql.
>>>
>>> jakob
>>>
>>> Terry Brick wrote:
>>>
>>>> I have a class descriptor (CLASS_A) with a reference
>>>> to another (CLASS_B).  Both CLASS_A and CLASS_B have a property called
>>>> "NAME".
>>>>
>>>> -If I retrieve CLASS_A objects (using PB) with no
>>>> orderby, everything is fine.
>>>>
>>>> -If I retrieve CLASS_A objects in the same manner, but
>>>> add a "CLASS_B_REF.SOME_OTHER_PROPERTY" orderby,
>>>> everything is fine.
>>>>
>>>> -However, if I retrieve CLASS_A objects after adding a
>>>> "CLASS_B_REF.NAME" orderby, the NAME value from
>>>> CLASS_B gets populated in the NAME properties of
>>>> *both* the CLASS_A and CLASS_B objects!
>>>>
>>>> In other words, if I add an orderby to my criteria and
>>>> that orderby is a referenced class with a property
>>>> name that exists in both the parent class and
>>>> referenced class, the referenced value is populated in
>>>> both the parent object and referenced object (they get
>>>> identical values).
>>>>
>>>> So for example, in the database, it may look like
>>>> this.....
>>>> TABLE_A.NAME = "FOO"
>>>> TABLE_B.NAME = "BAR"
>>>>
>>>> But in scenario described above, I get.....
>>>> CLASS_A.NAME = "BAR"
>>>> CLASS_B.NAME = "BAR
>>>>
>>>> One other note, in my mappings, my classes are the
>>>> same name as my tables and properties same names as
>>>> the columns.... in case that has anything to do with
>>>> it.  If necessary, I'll try to provide an exact
>>>> example with real mappings, sql, etc. so someone can
>>>> try to reproduce the effect.  I've tried this on both
>>>> RC4 and RC5.  I'm using MySQL.
>>>>
>>>> Any ideas?
>>>> Thanks!
>>>>
>>>> __________________________________
>>>> Do you Yahoo!?
>>>> New Yahoo! Photos - easier uploading and sharing.
>>>> http://photos.yahoo.com/
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>
>>
>>
>> __________________________________
>> Do you Yahoo!?
>> New Yahoo! Photos - easier uploading and sharing.
>> http://photos.yahoo.com/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 


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


Re: OrderBy of ref class having same property name = problem

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi terry,

i can reproduce the problem and i posted it to the developer list:

  http://article.gmane.org/gmane.comp.jakarta.ojb.devel/4830	

thanks for the testcase.
jakob

Terry Brick wrote:

> Thanks Jakob for your interest... took me a while to get back
> because I didn't see the response.  Anyway, I've included all info
> necessary to reproduce the problem...
> a) Table Structures
> b) Repository
> c) source code
> d) SQL generated on my system
> In the case below, the 'foo' property in 'table1' objects will
> have values from the 'foo' property of 'table2'.
> 
> 
> DDL
> =========================================================
> drop table table1;
> #----------------------------
> # Table structure for table1
> #----------------------------
> create table table1 (
>    TABLE1_ID int(10) not null default '0',
>    TABLE2_ID int(10) not null default '0',
>    FOO varchar(10) not null,
>    T1_COL varchar(10) not null,
>    primary key (TABLE1_ID))
>    type=MyISAM;
> 
> #----------------------------
> # Records for table table1
> #----------------------------
> insert  into table1 values 
> (1, 1, 'T1_FOO_A', 'T1_A'), 
> (2, 2, 'T1_FOO_B', 'T1_B');
> 
> drop table table2;
> #----------------------------
> # Table structure for table2
> #----------------------------
> create table table2 (
>    TABLE2_ID int(10) not null default '0',
>    FOO varchar(10) not null,
>    T2_COL varchar(10) not null,
>    primary key (TABLE2_ID))
>    type=MyISAM;
> 
> #----------------------------
> # Records for table table2
> #----------------------------
> insert  into table2 values 
> (1, 'T2_FOO_A', 'T2_A'), 
> (2, 'T2_FOO_B', 'T2_B');
> 
> 
> Repository
> ===============================================
> <class-descriptor class="com.ibeque.epique.businessobjects.Table1" table="table1">
>   <field-descriptor name="oid" column="TABLE1_ID" jdbc-type="BIGINT" primarykey="true"
> autoincrement="true" required="true" length="5"/>
>   <field-descriptor name="table2_id" column="TABLE2_ID" jdbc-type="BIGINT" required="true"
> length="10"/>
>   <field-descriptor name="foo" column="FOO" jdbc-type="VARCHAR" required="true" length="10"/>
>   <field-descriptor name="t1_col" column="T1_COL" jdbc-type="VARCHAR" required="true"
> length="10"/>
>   <reference-descriptor name="table2_id_ref" class-ref="com.ibeque.epique.businessobjects.Table2"
> auto-retrieve="false">
>      <foreignkey field-ref="table2_id"/>
>   </reference-descriptor>
> </class-descriptor>
> 
> <class-descriptor class="com.ibeque.epique.businessobjects.Table2" table="table2">
>   <field-descriptor name="oid" column="TABLE2_ID" jdbc-type="BIGINT" primarykey="true"
> autoincrement="true" required="true" length="5"/>
>   <field-descriptor name="foo" column="FOO" jdbc-type="VARCHAR" required="true" length="10"/>
>   <field-descriptor name="t2_col" column="T2_COL" jdbc-type="VARCHAR" required="true"
> length="10"/>
> </class-descriptor>
> 
> 
> Source Code
> =======================================================
> Criteria criteria = new Criteria();
> QueryByCriteria q = QueryFactory.newQuery(Table1.class, criteria);
> q.addOrderBy("table2_id_ref.foo",true);
> results = (List) broker.getCollectionByQuery(q);
> 
> 
> 
> 
> Generated SQL
> =======================================
> SELECT 
> 	A0.T1_COL,
> 	A0.TABLE2_ID,
> 	A0.FOO,A0.TABLE1_ID,
> 	A1.FOO 
> FROM 
> 	table1 A0 
> INNER JOIN 
> 	table2 A1 
> ON 
> 	A0.TABLE2_ID=A1.TABLE2_ID 
> ORDER BY 5
> 
> 
> 
> 
> 
> 
> --- Jakob Braeuchi <jb...@gmx.ch> wrote:
> 
>>hi terry,
>>
>>please post the repository and the generated sql.
>>
>>jakob
>>
>>Terry Brick wrote:
>>
>>>I have a class descriptor (CLASS_A) with a reference
>>>to another (CLASS_B).  
>>>Both CLASS_A and CLASS_B have a property called
>>>"NAME".
>>>
>>>-If I retrieve CLASS_A objects (using PB) with no
>>>orderby, everything is fine.
>>>
>>>-If I retrieve CLASS_A objects in the same manner, but
>>>add a "CLASS_B_REF.SOME_OTHER_PROPERTY" orderby,
>>>everything is fine.
>>>
>>>-However, if I retrieve CLASS_A objects after adding a
>>>"CLASS_B_REF.NAME" orderby, the NAME value from
>>>CLASS_B gets populated in the NAME properties of
>>>*both* the CLASS_A and CLASS_B objects!
>>>
>>>In other words, if I add an orderby to my criteria and
>>>that orderby is a referenced class with a property
>>>name that exists in both the parent class and
>>>referenced class, the referenced value is populated in
>>>both the parent object and referenced object (they get
>>>identical values).
>>>
>>>So for example, in the database, it may look like
>>>this.....
>>>TABLE_A.NAME = "FOO"
>>>TABLE_B.NAME = "BAR"
>>>
>>>But in scenario described above, I get.....
>>>CLASS_A.NAME = "BAR"
>>>CLASS_B.NAME = "BAR
>>>
>>>One other note, in my mappings, my classes are the
>>>same name as my tables and properties same names as
>>>the columns.... in case that has anything to do with
>>>it.  If necessary, I'll try to provide an exact
>>>example with real mappings, sql, etc. so someone can
>>>try to reproduce the effect.  I've tried this on both
>>>RC4 and RC5.  I'm using MySQL.
>>>
>>>Any ideas?
>>>Thanks!
>>>
>>>__________________________________
>>>Do you Yahoo!?
>>>New Yahoo! Photos - easier uploading and sharing.
>>>http://photos.yahoo.com/
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>For additional commands, e-mail: ojb-user-help@db.apache.org
>>
> 
> 
> 
> __________________________________
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing.
> http://photos.yahoo.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 


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


Re: OrderBy of ref class having same property name = problem

Posted by Terry Brick <te...@yahoo.com>.
Thanks Jakob for your interest... took me a while to get back
because I didn't see the response.  Anyway, I've included all info
necessary to reproduce the problem...
a) Table Structures
b) Repository
c) source code
d) SQL generated on my system
In the case below, the 'foo' property in 'table1' objects will
have values from the 'foo' property of 'table2'.


DDL
=========================================================
drop table table1;
#----------------------------
# Table structure for table1
#----------------------------
create table table1 (
   TABLE1_ID int(10) not null default '0',
   TABLE2_ID int(10) not null default '0',
   FOO varchar(10) not null,
   T1_COL varchar(10) not null,
   primary key (TABLE1_ID))
   type=MyISAM;

#----------------------------
# Records for table table1
#----------------------------
insert  into table1 values 
(1, 1, 'T1_FOO_A', 'T1_A'), 
(2, 2, 'T1_FOO_B', 'T1_B');

drop table table2;
#----------------------------
# Table structure for table2
#----------------------------
create table table2 (
   TABLE2_ID int(10) not null default '0',
   FOO varchar(10) not null,
   T2_COL varchar(10) not null,
   primary key (TABLE2_ID))
   type=MyISAM;

#----------------------------
# Records for table table2
#----------------------------
insert  into table2 values 
(1, 'T2_FOO_A', 'T2_A'), 
(2, 'T2_FOO_B', 'T2_B');


Repository
===============================================
<class-descriptor class="com.ibeque.epique.businessobjects.Table1" table="table1">
  <field-descriptor name="oid" column="TABLE1_ID" jdbc-type="BIGINT" primarykey="true"
autoincrement="true" required="true" length="5"/>
  <field-descriptor name="table2_id" column="TABLE2_ID" jdbc-type="BIGINT" required="true"
length="10"/>
  <field-descriptor name="foo" column="FOO" jdbc-type="VARCHAR" required="true" length="10"/>
  <field-descriptor name="t1_col" column="T1_COL" jdbc-type="VARCHAR" required="true"
length="10"/>
  <reference-descriptor name="table2_id_ref" class-ref="com.ibeque.epique.businessobjects.Table2"
auto-retrieve="false">
     <foreignkey field-ref="table2_id"/>
  </reference-descriptor>
</class-descriptor>

<class-descriptor class="com.ibeque.epique.businessobjects.Table2" table="table2">
  <field-descriptor name="oid" column="TABLE2_ID" jdbc-type="BIGINT" primarykey="true"
autoincrement="true" required="true" length="5"/>
  <field-descriptor name="foo" column="FOO" jdbc-type="VARCHAR" required="true" length="10"/>
  <field-descriptor name="t2_col" column="T2_COL" jdbc-type="VARCHAR" required="true"
length="10"/>
</class-descriptor>


Source Code
=======================================================
Criteria criteria = new Criteria();
QueryByCriteria q = QueryFactory.newQuery(Table1.class, criteria);
q.addOrderBy("table2_id_ref.foo",true);
results = (List) broker.getCollectionByQuery(q);




Generated SQL
=======================================
SELECT 
	A0.T1_COL,
	A0.TABLE2_ID,
	A0.FOO,A0.TABLE1_ID,
	A1.FOO 
FROM 
	table1 A0 
INNER JOIN 
	table2 A1 
ON 
	A0.TABLE2_ID=A1.TABLE2_ID 
ORDER BY 5






--- Jakob Braeuchi <jb...@gmx.ch> wrote:
> hi terry,
> 
> please post the repository and the generated sql.
> 
> jakob
> 
> Terry Brick wrote:
> > I have a class descriptor (CLASS_A) with a reference
> > to another (CLASS_B).  
> > Both CLASS_A and CLASS_B have a property called
> > "NAME".
> > 
> > -If I retrieve CLASS_A objects (using PB) with no
> > orderby, everything is fine.
> > 
> > -If I retrieve CLASS_A objects in the same manner, but
> > add a "CLASS_B_REF.SOME_OTHER_PROPERTY" orderby,
> > everything is fine.
> > 
> > -However, if I retrieve CLASS_A objects after adding a
> > "CLASS_B_REF.NAME" orderby, the NAME value from
> > CLASS_B gets populated in the NAME properties of
> > *both* the CLASS_A and CLASS_B objects!
> > 
> > In other words, if I add an orderby to my criteria and
> > that orderby is a referenced class with a property
> > name that exists in both the parent class and
> > referenced class, the referenced value is populated in
> > both the parent object and referenced object (they get
> > identical values).
> > 
> > So for example, in the database, it may look like
> > this.....
> > TABLE_A.NAME = "FOO"
> > TABLE_B.NAME = "BAR"
> > 
> > But in scenario described above, I get.....
> > CLASS_A.NAME = "BAR"
> > CLASS_B.NAME = "BAR
> > 
> > One other note, in my mappings, my classes are the
> > same name as my tables and properties same names as
> > the columns.... in case that has anything to do with
> > it.  If necessary, I'll try to provide an exact
> > example with real mappings, sql, etc. so someone can
> > try to reproduce the effect.  I've tried this on both
> > RC4 and RC5.  I'm using MySQL.
> > 
> > Any ideas?
> > Thanks!
> > 
> > __________________________________
> > Do you Yahoo!?
> > New Yahoo! Photos - easier uploading and sharing.
> > http://photos.yahoo.com/
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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


Re: OrderBy of ref class having same property name = problem

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi terry,

please post the repository and the generated sql.

jakob

Terry Brick wrote:
> I have a class descriptor (CLASS_A) with a reference
> to another (CLASS_B).  
> Both CLASS_A and CLASS_B have a property called
> "NAME".
> 
> -If I retrieve CLASS_A objects (using PB) with no
> orderby, everything is fine.
> 
> -If I retrieve CLASS_A objects in the same manner, but
> add a "CLASS_B_REF.SOME_OTHER_PROPERTY" orderby,
> everything is fine.
> 
> -However, if I retrieve CLASS_A objects after adding a
> "CLASS_B_REF.NAME" orderby, the NAME value from
> CLASS_B gets populated in the NAME properties of
> *both* the CLASS_A and CLASS_B objects!
> 
> In other words, if I add an orderby to my criteria and
> that orderby is a referenced class with a property
> name that exists in both the parent class and
> referenced class, the referenced value is populated in
> both the parent object and referenced object (they get
> identical values).
> 
> So for example, in the database, it may look like
> this.....
> TABLE_A.NAME = "FOO"
> TABLE_B.NAME = "BAR"
> 
> But in scenario described above, I get.....
> CLASS_A.NAME = "BAR"
> CLASS_B.NAME = "BAR
> 
> One other note, in my mappings, my classes are the
> same name as my tables and properties same names as
> the columns.... in case that has anything to do with
> it.  If necessary, I'll try to provide an exact
> example with real mappings, sql, etc. so someone can
> try to reproduce the effect.  I've tried this on both
> RC4 and RC5.  I'm using MySQL.
> 
> Any ideas?
> Thanks!
> 
> __________________________________
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing.
> http://photos.yahoo.com/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 


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