Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 231485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:56:13+00:00 2026-05-11T19:56:13+00:00

hey i want to do nested sorting in hibernate. i have a set of

  • 0

hey i want to do nested sorting in hibernate.

i have a set of applications in course object. application has a time and type attribute.
I want to sort by type first and then within application of particular type i want to sort it by time.

can i use it as follows??

order-by="type desc,time asc" 

Note that type should be sorted descendingly ( type is a int datatype in java)
and time ascendingly (time is of date datatype in jave )

eg of ordering
Type time

5 1

5 2

5 3

4 1

4 2

time was given as integer in this example

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:56:13+00:00Added an answer on May 11, 2026 at 7:56 pm

    You can sort just like you said. You may also want to add the comparable interface to your objects so you can sort them in your services.

    The following hibernate file has an example of using an sql bit for sorting

    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
                                       "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <hibernate-mapping>
        <class name="au.gov.abs.maserati.domain.entity.CURF" 
            table="CURF" >
            <id name="ID" column="ID">
                <generator class="native" />
            </id>
    
            <property name="title" />
            <property name="description" />
            <property name="active"
                type="yes_no" 
                not-null="true" />
    
            <set name="specialConditions" cascade="none"
                order-by="sortOrder, Text1"
                where=" Discriminator in ( 'SPECIAL-CURF-AGREEMENT' ) and active = 'Y' ">
                <key column="parentID" not-null="false" />
                <one-to-many
                    class="au.gov.abs.maserati.domain.entity.Condition" />
            </set>
        </class>
    </hibernate-mapping>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey i got a contnet type that i made and i want to twweak
Hey Friends I want to make a form builder using Yii. For that I
hey i just want to gather the locations in google maps database which are
Hey guys i want to get the latitude and longitude of the users location.
hey guys i want to handle all exceptions within my android app in a
Hey guys my question is i want to detect if my user is using
Hey there, i want to store some session info from a database query, upon
Hey guys. i want to be able to position my image background similar to
Hey, I want to remove the whole line if a word exists in it?
Hey all, this is a follow up to this question: Regex syntax highlighting question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.