-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Casesensitivity in order by clause on Unix?!
PostPosted: Tue Sep 02, 2008 7:57 am 
Newbie

Joined: Fri Aug 05, 2005 9:55 am
Posts: 9
Hi,

I found a strange phenomenom when performing an order by on String values.

I fire this statement:

Quote:
getSession().createQuery(
"from RMT_DropDown where dropDownName= :name order by item").setString(
"name", name).list();



On Windows I get back a well-ordered result A-Z - so this works.

On Solaris however I get back a result which is sorted by upper-case letters first and then lower case.

Example:

Amsterdam
Munich
Zurich
amsterdam
munich
zurich

Both are running on the same Jboss 4.2.2 instance (Java 1.5).

Any ideas why this happens? I can circument this problem by changing the HQL-Statement to "from RMT_DropDown where dropDownName= :name order by lower(item)". But I dont understand why this happens? The ordering is done by the database and not by Hibernate...

Regards,
Thomas

Hibernate version: 3.2.4.sp1

Name and version of the database you are using: Oracle 9i

The generated SQL (show_sql=true):

Code:
select
        rmt_dropdo0_.dropDownID as dropDownID73_,
        rmt_dropdo0_.dropDownName as dropDown2_73_,
        rmt_dropdo0_.item as item73_,
        rmt_dropdo0_.value as value73_
    from
        RMT_DropDown rmt_dropdo0_
    where
        rmt_dropdo0_.dropDownName=?
    order by
        lower(rmt_dropdo0_.item)
Code:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 02, 2008 8:14 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
I am pretty sure this has something to do with database configuration. I have no experience with Oracle, but in MySQL you can specify character set and collation. Some collations are case-sensitive, some are case-insensitive. This can be done at server, database, table or column level. See for example: http://dev.mysql.com/doc/refman/5.1/en/ ... mysql.html

So I think your database on the Solaris server uses a case-sensitive collation to sort your data and the database on the Windows server uses a case-insensitive collation. You need to consult some Oracle documentation for information how to change this in Oracle.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 02, 2008 9:26 am 
Newbie

Joined: Fri Aug 05, 2005 9:55 am
Posts: 9
Hi nordborg,

Thanks for your reply. Yes, I thought of that, but it actually is a dedicated database server which is used - so it is the same for Win and Solaris. Sorry, I should have mentioned that.

Regards,
Thomas


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 02, 2008 1:45 pm 
Newbie

Joined: Sat Aug 02, 2008 12:09 pm
Posts: 12
This might have something to do with the jdbc driver you are are using. Are you using oracles native jdbc driver or the thin one?

Cheers

G


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 03, 2008 4:51 am 
Newbie

Joined: Fri Aug 05, 2005 9:55 am
Posts: 9
This is the driver information, it is the same JAR for both servers.

Quote:
Manifest-Version: 1.0
Specification-Title: Oracle JDBC driver classes for use with JDK14
Sealed: true
Created-By: 1.4.2_08 (Sun Microsystems Inc.)
Implementation-Title: ojdbc14.jar
Specification-Vendor: Oracle Corporation
Specification-Version: Oracle JDBC Driver version - "10.2.0.3.0"
Implementation-Version: Oracle JDBC Driver version - "10.2.0.3.0"
Implementation-Vendor: Oracle Corporation
Implementation-Time: Fri Sep 29 09:43:24 2006

Name: oracle/sql/converter/
Sealed: false

Name: oracle/sql/
Sealed: false

Name: oracle/sql/converter_xcharset/
Sealed: false


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.