Fredrik,

I'll have a look mid next week, as it's a rather long public holiday weekend here in 
Vienna. Just one immediate question, though. Well, two actually. 
First, can you please send the Java files for the classes defined in the mapping file. 
And why do you not have any OQL to show ?

Werner

On Fri, 28 May 2004 13:57:18 +0200, Richtn�r Fredrik wrote:

>Hi,
>
>You asked for more info. Here it is. I would appreciate if you had time to comment on 
>what I write.
>
>/Fredrik
>
>-----Original Message-----
>From: Richtn�r Fredrik 
>Sent: den 26 maj 2004 17:07
>To: '[EMAIL PROTECTED]'
>Subject: RE: [castor-user] DB2 sortorder for OUTER JOINs
>
>Hello,
>
>Here are more input on the subject. I'm working on porting the Content Management 
>System www.infoglue.org to DB2.
>
>Extract from mapping file:
>...
><!--  Mapping for RepositoryLanguage  -->
>  <class 
> name="org.infoglue.cms.entities.management.impl.simple.RepositoryLanguageImpl" 
> identity="repositoryLanguageId" key-
generator="IDENTITY">
>    <description>RepositoryLanguage</description>
>    <cache-type type="none"/>
>    <map-to table="cmRepositoryLanguage"/>
>      <field name="repositoryLanguageId" type="java.lang.Integer">
>      <sql name="repositoryLanguageId" type="integer" dirty="check" />
>    </field>
>        <field name="isPublished" type="java.lang.Boolean">
>      <sql name="isPublished" type="integer" dirty="check" />
>    </field>
>        <field name="language" 
> type="org.infoglue.cms.entities.management.impl.simple.LanguageImpl">
>      <sql name="languageId"/>
>    </field>
>        <field name="repository" 
> type="org.infoglue.cms.entities.management.impl.simple.RepositoryImpl">
>      <sql name="repositoryId"/>
>    </field>
>    </class>
>...
><!--  Mapping for Language  -->
>  <class name="org.infoglue.cms.entities.management.impl.simple.LanguageImpl" 
> identity="languageId" key-generator="IDENTITY">
>    <description>Language</description>
>    <cache-type type="none"/>
>    <map-to table="cmLanguage"/>
>      <field name="languageId" type="java.lang.Integer">
>      <sql name="languageId" type="integer" dirty="check" />
>    </field>
>        <field name="name" type="java.lang.String">
>      <sql name="name" type="varchar" dirty="check" />
>    </field>
>        <field name="languageCode" type="java.lang.String">
>      <sql name="languageCode" type="varchar" dirty="check" />
>    </field>
>        <field name="charset" type="java.lang.String">
>      <sql name="charset" type="varchar" dirty="check" />
>    </field>
>        <field name="repositoryLanguages" 
> type="org.infoglue.cms.entities.management.impl.simple.RepositoryLanguageImpl" 
> lazy="true" 
collection="collection">
>      <sql many-key="languageId"/>
>    </field>
>    </class>
>...
>
>OQL query:
>Don't know.
>
>Generated SQL:
>SELECT cmLanguage.languageId,cmLanguage.name,cmLanguage.languageCode,
>cmLanguage.charset,cmRepositoryLanguage.repositoryLanguageId
>FROM cmLanguage LEFT OUTER JOIN cmRepositoryLanguage on 
>cmLanguage.languageId=cmRepositoryLanguage.languageId;
>
>Generated SQL I want to have:
>SELECT cmLanguage.languageId,cmLanguage.name,cmLanguage.languageCode,
>cmLanguage.charset,cmRepositoryLanguage.repositoryLanguageId
>FROM cmLanguage LEFT OUTER JOIN cmRepositoryLanguage on 
>cmLanguage.languageId=cmRepositoryLanguage.languageId
>ORDER BY cmLanguage.languageId BY cmRepositoryLanguage.repositoryLanguageId;
>
>Without the "ORDER BY" clause DB2 returns the records in a different order. IBM says 
>that the sortorder is undefined and ORDER BY must be used.
>
>As I see it it would not have a negative impact on other databases to add an ORDER BY 
>clause on all the "identity" columns since Castor internally 
removes doubles (copies) of records and only returns unique records based on the 
"identity" column.
>
>Regards,
>Fredrik
>WM-data
>
>
>
>-----Original Message-----
>From: Werner Guttmann [mailto:[EMAIL PROTECTED] 
>Sent: den 25 maj 2004 16:35
>To: [EMAIL PROTECTED]
>Subject: Re: [castor-user] DB2 sortorder for OUTER JOINs
>
>Fredrik,
>
>can you please provide me with a full example, incl. the OQL statement you want to 
>use, the SQL generated, the classes used, mapping file, etc.
>
>Regards
>Werner
>
>On Tue, 25 May 2004 16:12:09 +0200, Richtn�r Fredrik wrote:
>
>>Hello,
>>
>>I'm using Castor on DB2. The thing is that DB2 sorts the resultset differently than 
>>other databases (MySQL, Oracle) for OUTER JOINs. The hint I got 
from 
>IBM is to add ORDER BY to the SQL query. So my question to the list is if it is 
>possible to configure Castor to add ORDER BY clauses to the SQL 
>generated?
>>
>>/Fredrik
>>WM-data
>>
>>
>
>

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to