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, hi i want put limit on object creation means a class can have
Hey. I have a function I want to memoize, however, it has too many
Hey I want to create a layout like this for my application. Of course
If i have {code}{type=hey} and I want to replace it with <code><pre class=hey> how
Hey, I want to store application configuration data. Currently, I'm using INIs but they
Hey i dont know if that is possible but i want to set a
hey I want to make a call from my application, so far I found
Hey guys i want to parse this type of string: {1: [ {OrderItemId:832,ItemId:995,Price:0}, {OrderItemId:833,ItemId:997,Price:0},
hey every one I want to alert value of n from this string $('.orbit-bullets:has(
Hey! i want to know the best solution for my problem. I have a

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.