Re: Sorting Child Objects

2005-02-08 Thread Robert S. Sfeir
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Feb 8, 2005, at 2:06 PM, Jakob Braeuchi wrote:
hi robert,
imo this behaviour is not specific to child objects. i would also 
expect it when using getCollectionByQuery with a 'non-sortable' 
collection class.
so i think we'd better document it.

Hum I have a few of those, and I don't see the behavior, weird.  OK 
better document for sure...  problem is often folks won't read docs, I 
was thinking a more blunt approach might get their attention :-)

R
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCCRmcJhqny0eCHK8RAhbkAJ4kqFNJk6HbKP6YOfHQB3h29/Z9cQCghtl0
H8EGGemCoo0IjpgMOkGlBm0=
=x8nO
-END PGP SIGNATURE-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Sorting Child Objects

2005-02-08 Thread Jakob Braeuchi
hi robert,
imo this behaviour is not specific to child objects. i would also expect 
it when using getCollectionByQuery with a 'non-sortable' collection class.
so i think we'd better document it.

jakob
Robert S. Sfeir schrieb:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Steps 1.) and 2.) are imo ok. the sql contains an order by and 
ArrayList  also maintains the order.
The problem is in step 3.) how could we warn the user that his list 
may cause sorting problems ?

Yup exactly what I was originally thinking, I do think however that we 
can just change from a HashSet to a SortedSet, then the ArrayList and 
*Set Impl will work.  HashSet is fine for speed I guess if there is no 
ordering.  So maybe we check to see if we have orderedby and get a 
SortedSet, if not HashSet.  Then document behavior?  If not possible, 
then definitely throw an exception to get the user's attention.

R
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCB9+tJhqny0eCHK8RAhi5AJ4jyv7T1FqX1op3GJDUcB+IVCD9vgCdFLBf
oWyJ2aSiuWC9FVN9aBi1qH8=
=wf8c
-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]


Re: Sorting Child Objects

2005-02-08 Thread Christoph Hermann
Robert S. Sfeir schrieb:

Hello,

> >  ObjectCachePerBrokerImpl
> > now its working fine (until i get a problem with that ;-)).
>
> You wouldn't be using Spring Framework by any chance?  I did that
> because Spring requires it as well.

No, i'm just using Cocoon.

Christoph


pgpZOXSeilpwA.pgp
Description: PGP signature


Re: Sorting Child Objects

2005-02-08 Thread Robert S. Sfeir
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Feb 8, 2005, at 9:33 AM, Christoph Hermann wrote:
 ObjectCachePerBrokerImpl
now its working fine (until i get a problem with that ;-)).
You wouldn't be using Spring Framework by any chance?  I did that 
because Spring requires it as well.

R
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCCNnaJhqny0eCHK8RAopwAJsHLpfuf2/z5VBFxRvyYMaACgwQ5wCcCRkh
JIHFyFal+vuNAO9ZwL/4gl8=
=81A9
-END PGP SIGNATURE-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Sorting Child Objects

2005-02-08 Thread Christoph Hermann
Robert S. Sfeir schrieb:

Hello,

> > I have a similar Problem (i think).
> > When retrieving a Collection for the first time, the order is fine
> > like i want it.
> > When retrieving it a second or third, or ... time i seem to get a
> > random
> > order.
>
> My disordering is consistently ordered by record ID.  So it's not out
> of order, just not the order I'm telling it to orderby.

Ah, ic.
My Problem is solved (for now).
I changed the Cache implementation from
 ObjectCacheDefaultImpl
to
 ObjectCachePerBrokerImpl
now its working fine (until i get a problem with that ;-)).

Christoph


pgp0QlZJYE5sT.pgp
Description: PGP signature


Re: Sorting Child Objects

2005-02-08 Thread Robert S. Sfeir
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Feb 8, 2005, at 7:16 AM, Christoph Hermann wrote:
I have a similar Problem (i think).
When retrieving a Collection for the first time, the order is fine like
i want it.
When retrieving it a second or third, or ... time i seem to get a 
random
order.
My disordering is consistently ordered by record ID.  So it's not out 
of order, just not the order I'm telling it to orderby.

R
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCCMSDJhqny0eCHK8RApICAJ4gjEWsxIcn6s3r5tm7pcfWtP4HHgCeKEt6
eojTr+KCFnjN+bHFcjT7Xzo=
=AsKJ
-END PGP SIGNATURE-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Sorting Child Objects

2005-02-08 Thread Christoph Hermann
Robert S. Sfeir schrieb:

Hello,

> > Steps 1.) and 2.) are imo ok. the sql contains an order by and
> > ArrayList  also maintains the order.
> > The problem is in step 3.) how could we warn the user that his list
> > may cause sorting problems ?
>
> Yup exactly what I was originally thinking, I do think however that
> we can just change from a HashSet to a SortedSet, then the ArrayList
> and *Set Impl will work.  HashSet is fine for speed I guess if there
> is no ordering.  So maybe we check to see if we have orderedby and
> get a SortedSet, if not HashSet.  Then document behavior?  If not
> possible, then definitely throw an exception to get the user's
> attention.

I have a similar Problem (i think).
When retrieving a Collection for the first time, the order is fine like 
i want it.
When retrieving it a second or third, or ... time i seem to get a random 
order.
I have this Problem when displaying the collection of objects on cocoon 
with cforms in a repeater.
Updating in the database works fine, the field by which i want to sort 
is ok.

My Repository looks like this:


   



sortNumber is a Field in the class ProfileMenuCategory.


...
  

For the collection in the java Class i use an ArrayList.

Did i do something wrong? Or how can i track the Problem further down?

Christoph


pgpRXt3sOqiUy.pgp
Description: PGP signature


Re: Sorting Child Objects

2005-02-07 Thread Robert S. Sfeir
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Steps 1.) and 2.) are imo ok. the sql contains an order by and 
ArrayList  also maintains the order.
The problem is in step 3.) how could we warn the user that his list 
may cause sorting problems ?
Yup exactly what I was originally thinking, I do think however that we 
can just change from a HashSet to a SortedSet, then the ArrayList and 
*Set Impl will work.  HashSet is fine for speed I guess if there is no 
ordering.  So maybe we check to see if we have orderedby and get a 
SortedSet, if not HashSet.  Then document behavior?  If not possible, 
then definitely throw an exception to get the user's attention.

R
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCB9+tJhqny0eCHK8RAhi5AJ4jyv7T1FqX1op3GJDUcB+IVCD9vgCdFLBf
oWyJ2aSiuWC9FVN9aBi1qH8=
=wf8c
-END PGP SIGNATURE-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Sorting Child Objects

2005-02-07 Thread Robert S. Sfeir
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
OOPS make that SortedSet, Tree set won't do it either
On Feb 7, 2005, at 4:33 PM, Robert S. Sfeir wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Armin,
I think the issue might be that we're using a HashSet not an 
OrderedSet or as Brian suggested TreeSet.

it seems that in general in OJB we should be using sorable sets, 
though hash is faster of course, because of the nature of the purpose.

R
On Feb 7, 2005, at 4:23 PM, Robert S. Sfeir wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Feb 7, 2005, at 4:03 PM, Jakob Braeuchi wrote:
hi robert,
i added a simple testcase QueryTest#testPrefetchedCollectionOrderBy 
that uses the orderby attribute of the CollectionDescriptor.
this test passes without any problems.
The only potential problem i see is in 
ColllectionPrefetcher#associateBatched().
...
  else
   {
   ManageableCollection col = 
createCollection(collectionClass);
   for (Iterator it2 = list.iterator(); it2.hasNext();)
   {
   col.ojbAdd(it2.next());
   }
   result = col;
   }
...
if the collectionClass of CollectionDescriptor does not maintain the 
order the we have a problem.
Yup that looks like it, I use ManageableCollection, specifically the 
Set impl but changed to ArrayList impl, it's relying on the 
Collection to maintain its natural order, hence if the Collection is 
not sortable, it just adds them as it gets them. (at least this is 
what I understand from the code).  Something has to happen there to 
tell the user they're full of it, and that you can't sort.

R
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCB9xEJhqny0eCHK8RAjohAJ4srmUKZ+FpWe6n1mKxjzf0HH/VYwCaA1jZ
kIUY2hDxVeTCadrHpy7KNbI=
=BiF0
-END PGP SIGNATURE-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCB97HJhqny0eCHK8RAmQgAJ9EYCUdwjYuGW0lPwQ960x8l8L/6wCffYmR
YsR4f7d2BMbqtRpmqp7rTaU=
=7QPO
-END PGP SIGNATURE-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCB98QJhqny0eCHK8RAhuqAJ9ATlwArcQrjGrhizSvutDSxBHH/gCfQCgy
ygtF5NuOZ3NaElAqvL7b7KQ=
=cgb5
-END PGP SIGNATURE-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Sorting Child Objects

2005-02-07 Thread Jakob Braeuchi
hi robert,
there are three important steps that could affect sort order:
1.) the prefetched collection is sorted if the CollectionDescriptor 
defines an 'orderby'.

2.) CollectionDescriptor#associateBatched where ownerIdsToLists is 
initialized with a temporary ArrayList for each owner.

3.) CollectionDescriptor#associateBatched where the final collection 
(based on collectionClass)is created for the owner.

Steps 1.) and 2.) are imo ok. the sql contains an order by and ArrayList 
 also maintains the order.
The problem is in step 3.) how could we warn the user that his list may 
cause sorting problems ?

jakob
Robert S. Sfeir schrieb:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Feb 7, 2005, at 4:03 PM, Jakob Braeuchi wrote:
hi robert,
i added a simple testcase QueryTest#testPrefetchedCollectionOrderBy 
that uses the orderby attribute of the CollectionDescriptor.
this test passes without any problems.
The only potential problem i see is in 
ColllectionPrefetcher#associateBatched().
...
  else
   {
   ManageableCollection col = 
createCollection(collectionClass);
   for (Iterator it2 = list.iterator(); it2.hasNext();)
   {
   col.ojbAdd(it2.next());
   }
   result = col;
   }
...
if the collectionClass of CollectionDescriptor does not maintain the 
order the we have a problem.

Yup that looks like it, I use ManageableCollection, specifically the Set 
impl but changed to ArrayList impl, it's relying on the Collection to 
maintain its natural order, hence if the Collection is not sortable, it 
just adds them as it gets them. (at least this is what I understand from 
the code).  Something has to happen there to tell the user they're full 
of it, and that you can't sort.

R
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCB9xEJhqny0eCHK8RAjohAJ4srmUKZ+FpWe6n1mKxjzf0HH/VYwCaA1jZ
kIUY2hDxVeTCadrHpy7KNbI=
=BiF0
-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]


Re: Sorting Child Objects

2005-02-07 Thread Robert S. Sfeir
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Armin,
I think the issue might be that we're using a HashSet not an OrderedSet 
or as Brian suggested TreeSet.

it seems that in general in OJB we should be using sorable sets, though 
hash is faster of course, because of the nature of the purpose.

R
On Feb 7, 2005, at 4:23 PM, Robert S. Sfeir wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Feb 7, 2005, at 4:03 PM, Jakob Braeuchi wrote:
hi robert,
i added a simple testcase QueryTest#testPrefetchedCollectionOrderBy 
that uses the orderby attribute of the CollectionDescriptor.
this test passes without any problems.
The only potential problem i see is in 
ColllectionPrefetcher#associateBatched().
...
  else
   {
   ManageableCollection col = 
createCollection(collectionClass);
   for (Iterator it2 = list.iterator(); it2.hasNext();)
   {
   col.ojbAdd(it2.next());
   }
   result = col;
   }
...
if the collectionClass of CollectionDescriptor does not maintain the 
order the we have a problem.
Yup that looks like it, I use ManageableCollection, specifically the 
Set impl but changed to ArrayList impl, it's relying on the Collection 
to maintain its natural order, hence if the Collection is not 
sortable, it just adds them as it gets them. (at least this is what I 
understand from the code).  Something has to happen there to tell the 
user they're full of it, and that you can't sort.

R
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCB9xEJhqny0eCHK8RAjohAJ4srmUKZ+FpWe6n1mKxjzf0HH/VYwCaA1jZ
kIUY2hDxVeTCadrHpy7KNbI=
=BiF0
-END PGP SIGNATURE-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCB97HJhqny0eCHK8RAmQgAJ9EYCUdwjYuGW0lPwQ960x8l8L/6wCffYmR
YsR4f7d2BMbqtRpmqp7rTaU=
=7QPO
-END PGP SIGNATURE-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Sorting Child Objects

2005-02-07 Thread Robert S. Sfeir
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Feb 7, 2005, at 4:03 PM, Jakob Braeuchi wrote:
hi robert,
i added a simple testcase QueryTest#testPrefetchedCollectionOrderBy 
that uses the orderby attribute of the CollectionDescriptor.
this test passes without any problems.
The only potential problem i see is in 
ColllectionPrefetcher#associateBatched().
...
  else
   {
   ManageableCollection col = 
createCollection(collectionClass);
   for (Iterator it2 = list.iterator(); it2.hasNext();)
   {
   col.ojbAdd(it2.next());
   }
   result = col;
   }
...
if the collectionClass of CollectionDescriptor does not maintain the 
order the we have a problem.
Yup that looks like it, I use ManageableCollection, specifically the 
Set impl but changed to ArrayList impl, it's relying on the Collection 
to maintain its natural order, hence if the Collection is not sortable, 
it just adds them as it gets them. (at least this is what I understand 
from the code).  Something has to happen there to tell the user they're 
full of it, and that you can't sort.

R
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCB9xEJhqny0eCHK8RAjohAJ4srmUKZ+FpWe6n1mKxjzf0HH/VYwCaA1jZ
kIUY2hDxVeTCadrHpy7KNbI=
=BiF0
-END PGP SIGNATURE-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Sorting Child Objects

2005-02-07 Thread Jakob Braeuchi
hi robert,
i added a simple testcase QueryTest#testPrefetchedCollectionOrderBy that 
uses the orderby attribute of the CollectionDescriptor.
this test passes without any problems.
The only potential problem i see is in 
ColllectionPrefetcher#associateBatched().
...
  else
   {
   ManageableCollection col = 
createCollection(collectionClass);
   for (Iterator it2 = list.iterator(); it2.hasNext();)
   {
   col.ojbAdd(it2.next());
   }
   result = col;
   }
...
if the collectionClass of CollectionDescriptor does not maintain the 
order the we have a problem.

jakob
Jakob Braeuchi schrieb:
hi robert,
the sql contains the orderby.  the problem seems to be the prefetcher. 
i'll have a look at it.

jakob
Robert S. Sfeir schrieb:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Feb 7, 2005, at 11:52 AM, Jakob Braeuchi wrote:
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 ?

Not that I could see in child objects, which is why I think it's 
affected after the select happens using Collections.sort(...).

R
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCB55mJhqny0eCHK8RAjTMAJ0ddp+xgzh/yYz8Jyk9zcE4S6UJbgCeId3D
STOb3QdpeEPrdW2K6k0opzE=
=aJ9L
-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]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Sorting Child Objects

2005-02-07 Thread Jakob Braeuchi
hi robert,
the sql contains the orderby.  the problem seems to be the prefetcher. 
i'll have a look at it.

jakob
Robert S. Sfeir schrieb:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Feb 7, 2005, at 11:52 AM, Jakob Braeuchi wrote:
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 ?

Not that I could see in child objects, which is why I think it's 
affected after the select happens using Collections.sort(...).

R
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCB55mJhqny0eCHK8RAjTMAJ0ddp+xgzh/yYz8Jyk9zcE4S6UJbgCeId3D
STOb3QdpeEPrdW2K6k0opzE=
=aJ9L
-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]


Re: Sorting Child Objects

2005-02-07 Thread Robert S. Sfeir
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Feb 7, 2005, at 11:52 AM, Jakob Braeuchi wrote:
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 ?
Not that I could see in child objects, which is why I think it's 
affected after the select happens using Collections.sort(...).

R
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCB55mJhqny0eCHK8RAjTMAJ0ddp+xgzh/yYz8Jyk9zcE4S6UJbgCeId3D
STOb3QdpeEPrdW2K6k0opzE=
=aJ9L
-END PGP SIGNATURE-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Sorting Child Objects

2005-02-07 Thread Jakob Braeuchi
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 unsu

Re: Sorting Child Objects

2005-02-07 Thread Robert S. Sfeir
-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.  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]


Re: Sorting Child Objects

2005-02-07 Thread Jakob Braeuchi
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]


Re: Sorting Child Objects

2005-02-06 Thread Robert S. Sfeir
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Jacob, I tried adding orderby to at least have a default sort for 
collections...  it does nothing, the order is wrong.  I added 
orderby="order" which is the field name in the referenced collection, 
the sort is not even close, either there's a bug (and I should dig into 
it) or I didn't understand how to use it.

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)
iD8DBQFCBmFfJhqny0eCHK8RAgegAJ98vIxFDOi7w1nNE0HrAYjnQ+KfYwCfZ4Te
CeJ29I/wlx8Q1DWNWcWVQg8=
=iode
-END PGP SIGNATURE-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Sorting Child Objects

2005-02-06 Thread Robert S. Sfeir
-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]


Re: Sorting Child Objects

2005-02-06 Thread Jakob Braeuchi
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]


Sorting Child Objects

2005-02-05 Thread Robert S. Sfeir
-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]