Quantcast

ignoreCase()

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

ignoreCase()

suryazi
Hi,

     It seems ignoreCase() stopped working in Grails 2.0.3 when applied to 'order' part in Criteria. For example, previously it was possible to write order(sortIndex, sortOrder).ignoreCase()

 Now it gives an exception

No signature of method: grails.orm.HibernateCriteriaBuilder.ignoreCase() is applicable for argument types: () values: []. Stacktrace follows:
Message: No signature of method: grails.orm.HibernateCriteriaBuilder.ignoreCase() is applicable for argument types: () values: []
    Line | Method
->> 1649 | invokeMethod      in grails.orm.HibernateCriteriaBuilder
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|     27 | doCall            in org.example.ContactController$_closure1_closure2$$ENay7VJ4
|   1732 | invokeClosureNode in grails.orm.HibernateCriteriaBuilder
|   1443 | invokeMethod      in     ''
|     17 | doCall . . . . .  in org.example.ContactController$_closure1$$ENay7VJ2
|   1110 | runWorker         in java.util.concurrent.ThreadPoolExecutor
|    603 | run . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run               in java.lang.Thread

Is there any other recommended way now for case-insensitive sorting in criteria ?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ignoreCase()

OverZealous
In normal Criteria, you can use this method:

    import org.hibernate.criterion.Order
    ...

    order(new Order(param, dir=='asc').ignoreCase())
    order((dir=='asc' ? Order.asc(param) : Order.desc(param)).ignoreCase())

Or, if the direction is static:

    order( Order.asc("name").ignoreCase() )

Personally, I don't like this method, and there is actually no supported method for DetachedCriteria (without adding at the end).

Please vote for this bug to get a standard way to sort case-insensitively: http://jira.grails.org/browse/GRAILS-9171

- Phil DeJarnett

suryazi wrote:
Hi,

    It seems ignoreCase() stopped working in Grails 2.0.3 when applied to
'order' part in Criteria. For example, previously it was possible to write
*order(sortIndex, sortOrder).ignoreCase()*

Now it gives an exception

No signature of method: grails.orm.HibernateCriteriaBuilder.ignoreCase() is
applicable for argument types: () values: []. Stacktrace follows:
Message: No signature of method:
grails.orm.HibernateCriteriaBuilder.ignoreCase() is applicable for argument
types: () values: []
   Line | Method
->> 1649 | invokeMethod      in grails.orm.HibernateCriteriaBuilder
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|     27 | doCall            in
org.example.ContactController$_closure1_closure2$$ENay7VJ4
|   1732 | invokeClosureNode in grails.orm.HibernateCriteriaBuilder
|   1443 | invokeMethod      in     ''
|     17 | doCall . . . . .  in
org.example.ContactController$_closure1$$ENay7VJ2
|   1110 | runWorker         in java.util.concurrent.ThreadPoolExecutor
|    603 | run . . . . . . . in
java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run               in java.lang.Thread

/Is there any other recommended way now for case-insensitive sorting in
criteria ?/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: ignoreCase()

suryazi
Voted and requesting other members of the forum to do so.

OverZealous wrote
In normal Criteria, you can use this method:

    import org.hibernate.criterion.Order
    ...

    order(new Order(param, dir=='asc').ignoreCase())
    order((dir=='asc' ? Order.asc(param) : Order.desc(param)).ignoreCase())

Or, if the direction is static:

    order( Order.asc("name").ignoreCase() )

Personally, I don't like this method, and there is actually no supported method for DetachedCriteria (without adding at the end).

Please vote for this bug to get a standard way to sort case-insensitively: http://jira.grails.org/browse/GRAILS-9171

- Phil DeJarnett

suryazi wrote:
> Hi,
>
>     It seems ignoreCase() stopped working in Grails 2.0.3 when applied to
> 'order' part in Criteria. For example, previously it was possible to write
> *order(sortIndex, sortOrder).ignoreCase()*
>
> Now it gives an exception
>
> No signature of method: grails.orm.HibernateCriteriaBuilder.ignoreCase() is
> applicable for argument types: () values: []. Stacktrace follows:
> Message: No signature of method:
> grails.orm.HibernateCriteriaBuilder.ignoreCase() is applicable for argument
> types: () values: []
>    Line | Method
> ->> 1649 | invokeMethod      in grails.orm.HibernateCriteriaBuilder
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> |     27 | doCall            in
> org.example.ContactController$_closure1_closure2$$ENay7VJ4
> |   1732 | invokeClosureNode in grails.orm.HibernateCriteriaBuilder
> |   1443 | invokeMethod      in     ''
> |     17 | doCall . . . . .  in
> org.example.ContactController$_closure1$$ENay7VJ2
> |   1110 | runWorker         in java.util.concurrent.ThreadPoolExecutor
> |    603 | run . . . . . . . in
> java.util.concurrent.ThreadPoolExecutor$Worker
> ^    722 | run               in java.lang.Thread
>
> /Is there any other recommended way now for case-insensitive sorting in
> criteria ?/
Loading...