Phil DeJarnett
2012-05-23 20:42:31 UTC
I've been trying to figure out how to implement a non-database specific case-insensitive order using DetachedCriteria. I've found that the order(param, dir).ignoreCase() trick was broken in Grails 2.0.
In place of that, it looks like Graeme added the ability to use this very awkward syntax in normal Criteria:
order(new org.hibernate.criterion.Order(param, dir=='asc').ignoreCase())
But this doesn't work in DetachedCriteria, as this form of the method doesn't exist. (More specifically, it looks like DetachedCriteria uses some kind of internal representation for ordering, which doesn't have any way to track a case option.)
Is there any practical way to handle case-insensitive ordering with DetachedCriteria?
It seems like this is a relatively common need, it's surprising it's so awkward to get it working.
Thanks,
In place of that, it looks like Graeme added the ability to use this very awkward syntax in normal Criteria:
order(new org.hibernate.criterion.Order(param, dir=='asc').ignoreCase())
But this doesn't work in DetachedCriteria, as this form of the method doesn't exist. (More specifically, it looks like DetachedCriteria uses some kind of internal representation for ordering, which doesn't have any way to track a case option.)
Is there any practical way to handle case-insensitive ordering with DetachedCriteria?
It seems like this is a relatively common need, it's surprising it's so awkward to get it working.
Thanks,
--
Phil DeJarnett
OverZealous Creations, LLC
http://www.overzealous.com/
Phil DeJarnett
OverZealous Creations, LLC
http://www.overzealous.com/