Do you mean to say that your TITRE column includes values which are numbers (like "42") and also values which are letters (like "NON") and that different environments cause these values of the TITRE column to appear in different sequences?
seems like there is some additional sorting happening in java side
( to verify above may be you can write a simple java code seperately that fetches the records using same HQL )
did you try adding debug statements just after running HQL , or the results you are telling us are the one you see on UI
can you post exact java code , SQL create table command ... i will like to make a small app and run it my self
It could also mean that Java and Oracle sort using different collation rules.
Oracle databases have some default collation order, and that might be different from the default ordering of Strings in Java. The default Java ordering of Strings is not always what you might want, as various lexicographical rules are not honored by it. This is what Java collators are for, as these perform locale-sensitive String comparison.
In Oracle, instead of collators you can use the NLSSORT function or NLS_SORT session parameter to use different collation rules, either in one query, or in your entire session. (Be aware that using NLS_SORT different form the database's default can affect query plans and hinder performance, as indexes are obviously usable only for one collation order. You may need to create indexes for other collations, if you want to use them.)
It's possible that either Oracle and Java default sorting order are not compatible with each other, or that there is a Collator used in Java and/or NLS_SORT in Oracle that are not compatible. You may verify the value of Oracle's NLS_SORT parameter by executing the query:
I don't know Hibernate, but I'd be surprised if it didn't offer a way to set collation order to use (and it probably does, as googling Hibernate collation yields some interesting results). You might try to set the Hibernate collation order to be compatible with Oracle's (or the other way around, of course, but that could make the indexes unusable, see above).
Another way of going around it would be to always perform sort in Hibernate, that way it would always be consistent.