How can we arrange a column as int using the sleep API parameters?

Hi, I want to get a data form database using the sleep API.

This data should be sorted by column as number.

This column is defined as varchar in the database. But I have to get the number.

I ran into a problem using the criteria API, as it arranges as a string onlyly.

Example: I get data like

9, 8, 7, 6, 5, 4, 3, 2, 1,10

but I want the data to be

10,9,8,7,6,5,4,3,2,1

Are there any Hibernate methods for hidden varchar for a number, for example convert ("some column", int) or cast ("some column", int)?

+2
source share
1 answer

Projections.Cast() cast(column as type).

.AddOrder(Projections.Cast(NHibernateUtil.Int32, Projections.Property("stringColumn"))
+6

All Articles