hi robert,

Robert S. Sfeir schrieb:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yeah I know, I was avoiding the query customizer didn't want to make it that specific for this particular need, your suggestion of orderby turned out to be the perfect solution. That said, the orderby in the collection-descriptor doesn't order anything if the collection is not sortable.

that's strange. afaik orderby is only handled in the generated sql ?? does ojb at least include 'order by' in the sql ?

jakob

So if I had:

private Collection myFooChild = Collections.EMPTY_SET;

when OJB runs the query and then the sub query to go get myFooChild objects, and I have orderby="order" which is referenced in the collection-descriptor pointing to the Foo object's descriptor info, it sorts nothing, the myFooChild objects are sorted in what ever order they come back from the DB.

However, if I had:

private List myFooChild = Collections.EMPTY_LIST;

then orderby="order" works correctly and sorts the objects in the way I expect them to.

So either there's a bug in OJB, or OJB should be throwing an exception, or at the very least a warning, letting people know something like: "The [insert type of object name (Set, Collection)] you are trying to order your auto-retrieved objects using the orderby in your collection-descriptor is not sortable. Please change your object type to a sortable type in order for this functionality to work properly".

Just a thought.

Right now with the default orderby and using List, I do one select and get everything back the way I need it for the view, so the functionality is beautiful when it works, but I bet I'm not the only one who might have hit that and wondered what's going on. The orderby doesn't seem to affect the query itself, rather it affects the object after it's retrieved from the DB.

R


On Feb 7, 2005, at 11:36 AM, Jakob Braeuchi wrote:

hi robert,

the orderby should be used in the sql when retrieving this children. if you want to modify the orderby you could use a query-customizer.

hth
jakob


Robert S. Sfeir schrieb:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yes, that gives it a default, but there is no way to change that based on query as far as I can tell, I wanted to make sure I didn't miss anything.

R

On Feb 6, 2005, at 3:58 AM, Jakob Braeuchi wrote:

hi robert,

have you tried the orderby in collection-descriptor ?

jakob

Robert S. Sfeir schrieb:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Either I'm rusty or this is a little trickier to do...
The issue is that I have a TicketType, which has a Collection of Attribute which itself has a Collection of AttributeType.
When I do a select for a Collection of Attribute(s) for a TicketType (select * from ticket_types tt, attributes a where ticket_type=1 and tt.type_id = a.type_id order by a.attribute_order) I get a TicketType with its Attribute Collection and the Attribute Collection is correctly sorted by the order column. But I need to take this a step further because an Attribute has a Collection of AttributeValue(s), and I want those AttributeValue objects to also be sorted by a specific column.
In other words I need the 3rd IN query that OJB triggers to get the AttributeValue to be sorted...
What's the most efficient way to do this? I'd rather not do 2 selects myself, I like having one select and have OJB deal with the prefetched relationships... and sorting...
I have another example which goes deeper from project to tickettype etc...
Thanks
R
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCBVhrJhqny0eCHK8RAvnjAJ0ZxKTArcUkJyxQlBZJ36JuEWOg5wCfXiCP
56Ietiiuhj5oIMVgHTFepT8=
=WJoc
-----END PGP SIGNATURE-----
-------------------------------------------------------------------- -
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]

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCBhojJhqny0eCHK8RAsD7AJ9FW2OovX5gPaljRPfBY2QhVab4oQCghHlA
wDpEg4gAbx99IF0qJVzUuec=
=8LLJ
-----END PGP SIGNATURE-----


--------------------------------------------------------------------- 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]

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCB5xwJhqny0eCHK8RAlKjAJ9qNlv8zyZq+0ppZLJ9BFbAsk3LywCdF6zo
afLuz1fF5sns2KZt3yutPM8=
=H3wd
-----END PGP SIGNATURE-----


--------------------------------------------------------------------- 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