-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate and DB2's version changes with collating sequence
PostPosted: Wed Oct 06, 2004 10:43 am 
Beginner
Beginner

Joined: Fri Aug 06, 2004 9:01 am
Posts: 21
Hibernate version: 2.1.6

Name and version of the database you are using:Currently v7.10. DB2 v8 is about 1 year away.

Question: Using Criteria based queries, what is the best way to handle, at an application level, the shifting collating sequence in DB2 as it varies between versions?

I have developed an application that will select based on alphanumeric ranges and values (pretty straightforward), but there is a distinct difference in the resultset being returned between DB2 versions.

What is the "best practice" with Hibernate to accomodate this shift?

Also worth noting, the Java Comparator implementation for String object values may differ with a given DB2 collating sequence, and as such (in my application) form validation (such as with Struts) can become problematic as you are coding custom Comparator's to override the Java implementation to accomodate the DB2 implementation.

Example:

Java: 0 > A is false
DB2 v7.10: 0 > A is true

Java: Order is [0-9] then [A-Z]
DB2 v7.10: Order is [A-Z] then [0-9]

Below is an excerpt of the DB2 collating sequence details relevant to my question. Hopefully someone can offer some insight on how best to develop a Hibernate based query application to handle this shift.

Is this a matter of utilizing different dialects for DB2?
How does Hibernate handle the differences in versions without altering how an application returns results?

Or, is this just "the way it is" and however the DB2 implementation defines the collating sequence is how it is meant to be interpretted and any alteration to that interpretation requires an application change/update to accomodate a give user's desire view of the results?

Hope that makes sense, and thanks ahead of time for any replies! :)


****************************************************EXCERPT*****************************************************

Below is an article concerning DB2 version 8. This is demonstrating the collating sequence of differences between Version 7 (EBCDIC) and Version 8 (Unicode).
After the article is information labeled 2.3.2.3 / 2.3.2.1 and this is IBM's explanation of Unicode, EBCDIC and ASCII.

Abstract Unicode sorting sequence is different than EBCDIC sorting sequence Content The collation sequence for Unicode is different than the sequence used by EBCDIC. In Unicode, numeric characters are sorted before alphabetic characters. In EBCDIC, alphabetic characters are sorted before numeric characters. Your queries might return results in a different order than in DB2 Version 7. GROUP BY, range predicates such as BETWEEN, and functions like MIN and MAX might return different answer sets than those returned in Version 7.
Example: Assume that the NAME column in SYSIBM.SYSTABLES contains the following values: TEST1, TEST2, TEST3, TESTA, TESTB, TESTC. In Version 7 or Version 8 compatibility mode, you issue the following SQL query:

SELECT NAME FROM SYSIBM.SYSTABLES
ORDER BY NAME

DB2


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 06, 2004 10:50 am 
Beginner
Beginner

Joined: Fri Aug 06, 2004 9:01 am
Posts: 21
I should add to this, the Criteria driven queries are important.
In using them I am subject to the implementation of its class methods (i.e. Expression) and am unsure how best to accomodate the collating sequence changes for things such as:

Expression.between(key, value1, value2)
Expression.gt(key,value)

These Expressions will return different result sets based on the DB2 version and therefore the collating sequence, no?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 08, 2004 9:43 am 
Beginner
Beginner

Joined: Fri Aug 06, 2004 9:01 am
Posts: 21
ttt, someone...anyone?

Not enough info? No one has any idea? This is something super easy and I should know the answer so no one is replying because of the n00bular context of the question posed?

Someone slap me if I should know this answer or at least tell me "hey, we just don't have an answer to this bad boy"


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 11, 2004 9:43 am 
Beginner
Beginner

Joined: Fri Aug 06, 2004 9:01 am
Posts: 21
ttt^2


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.