hi phil,

i tried to add an 'orderby' (NOT 'orderBy' ) to the descriptor of class
Person of the ojb testcases:

..
      <collection-descriptor
         name="projects"
         orderby="PERSON_PROJECT.PROJECT_ID"
         element-class-ref="org.apache.ojb.broker.Project"
         auto-retrieve="true"
         auto-update="true"
         indirection-table="PERSON_PROJECT"
      >
         <fk-pointing-to-this-class column="PERSON_ID"/>
         <fk-pointing-to-element-class column="PROJECT_ID"/>
      </collection-descriptor>
..

the resulting sql is as follows:

SELECT A0.TITLE,A0.DESCRIPTION,A0.ID,PERSON_PROJECT.PROJECT_ID FROM PROJECT
A0,PERSON_PROJECT WHERE (PERSON_PROJECT.PERSON_ID = ? ) AND
PERSON_PROJECT.PROJECT_ID = A0.ID ORDER BY 4

hth
jakob

----- Original Message -----
From: "Phil Warrick" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Thursday, October 31, 2002 5:54 AM
Subject: orderby and non-composed M:N mapping


> Hi,
>
> It seems that one cannot use orderby to order a collection that uses an
> intermediate table with a sort attribute, as in:
>
>   <collection-descriptor
>           name="projects"
>           element-class-ref="org.apache.ojb.broker.Project"
>           auto-retrieve="true"
>           auto-update="true"
>           indirection-table="PERSON_PROJECT"
>           orderBy = "PERSON_PROJECT_SORTORDER"
>        >
>           <fk-pointing-to-this-class column="PERSON_ID"/>
>           <fk-pointing-to-element-class column="PROJECT_ID"/>
>        </collection-descriptor>
>     </class-descriptor>
>
> where the field PERSON_PROJECT_SORTORDER is in the PERSON_PROJECT table
> and orders the Projects referred to by a Person (error message below).
>
> Is the only workaround to use a non-decomposed M:N mapping and expose a
> an intermediary Java class?
>
> Thanks,
>
> Phil
>
> [Error] repository_user.xml:469:8: Attribute "orderBy" must be declared
> for element type "collection-descriptor".
>
>
> --
> To unsubscribe, e-mail:   <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>

Reply via email to