We're updating the issue view to help you get more done. 

Order.ignoreCase() only works for VARCHAR types, not CHAR types

Description

The case insensitive ordering in org.hibernate.criterion.Order only works for VARCHAR types, not CHAR types. The attached patch makes it work for both.

I'm not sure how expensive the type.sqlTypes( factory ) lookup is; if it's expensive you may wish to cache the result since it gets used twice now, which would make the current (attached) code of:

boolean lower = ignoreCase && type.sqlTypes( factory )[i]==Types.VARCHAR || type.sqlTypes( factory )[i]==Types.CHAR;

look more like:

boolean lower;
if(ignoreCase) {
int sqlType = type.sqlTypes( factory )[i];
lower = sqlType == Types.VARCHAR || sqlType == Types.CHAR;
} else {
lower = false;
}

Environment

Database: Ingres
Hibernate: I've actually been using the Order.java from CVS with hibernate 3.0, until 3.1 is released or the ignoreCase version is added to a 3.0 release.

Status

Assignee

Brett Meyer

Reporter

Tom Dunstan

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

3.1 beta 2

Priority

Minor