ok, still cant figure this out.  If i add the gradename column to the query
string like so:

String queryStr ="select job from " + Job.class.getName() + " where
deleted=0 order by jobname,gradename";

it thows an exception (understandibly) - it's trying to sort by gradename in
the wrong query:


SELECT A0.deleted,A0.jobname,A0.id,jobname,gradename FROM job A0 WHERE
A0.deleted =  0  ORDER BY 4,5

However, if i restart tomcat, the grade elements in jobs are sorted by name
(due to collection descriptior in the repositry), the ordering is lost when
i add a grade to a job - it appears at the end until the database is
restarted.

If there isnt a way to sort these elements, can i bodge it by clearing the
cache (assuming thats why i get the wrong ordering after entering data)?
How do i do this?

Thanks,

Daniel.

----- Original Message ----- 
From: "Daniel Perry" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Thursday, October 16, 2003 6:27 PM
Subject: 1:n relationship (sub element ordering)


> I've got two classes with a 1:n relationship - job and grade
> I want to order by the results of an OQL query by the field "jobname" from
> the table job, then within each job by the field "gradename".
>
> String queryStr= "select job from " + Job.class.getName() + " where
> deleted=0 order by jobname";
>
> The above handles the first bit of the ordering, but i am not sure how to
do
> the second level ordering.
>
> Both the job and grade have fields titled "deleted", i only want to select
> objects that dont have the deleted fields set.  The above query ignores
jobs
> with deleted set to 1, but not grades.  How can i acheive this?
>
> Thanks for you help!
>
> Daniel.
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to