Re: [OJB-developers] EqualToColumnCriteria an Aliases
Brought to you by:
thma
From: Oleg N. <on...@uk...> - 2002-05-18 22:03:52
|
Hi Jakob, On Saturday 18 May 2002 10:09, Jakob Braeuchi wrote: > > the column name translation should be performed only in SqlStatment and > > SqlGenerator. Do you agree? > > definitely yes. > > EqualToColumnCriteria is a special case because it explicetely uses the > column name (_not_ the field name) on the right side of =. > this column name should imho not be translated. > i'm not shure about the left side of =. if EqualToColumnCriteria is only > used in MtoNCriteria we could leave the column names on both sides > untranslated. 1) EqualToColumnCriteria can be created without MtoNCriteria via Criteria.addEqualToColumn(). In this case I believe that the field name should be used rather than column name, user shouldn't use column names in Java code at all, they should appear once in repository.xml. I agree with you that such method should be named addEqualToField rather that addEqualToColumn. BTW, why there is no addGreaterThanColumn method, and so on? 2) I believe that MtoNCriteria should be refactored, maybe even removed, but I haven't looked into this issue deeply yet. SqlStatement is able to handle M:N relations and there are testcases showing that, so there is absolutely no need to do this work twice and to introduce MtoNCriteria for that, and then to process MtoNCriteria as a very special case in SqlStatement. > what we definitely need to translate is an optional table name (ie. > T_PERSON.FNAME ) here T_PERSON should be replaced by the alias leading to > A0.FNAME. There is no 1:1 mapping between table names and aliases, one table may appear several times with different aliases. Regards, Oleg |