javaspringhibernatesql-order-byhbm

Want Order by in descending order through hibernate hbm xml mapping


My hibernate hbm xml has an attribute mapping as

<set name="batchExceptionComments" table="BATCH_EXCEPTION_COMMENTS" 
                inverse="true" fetch="select" lazy="false" order-by="commentId">
            <key>
                <column name="EXCEPTION_ID" not-null="true" />
            </key>
            <one-to-many class="com.beans.BatchExceptionComments" />
        </set>

I am using order-by="commentId" which arranges the set by id in ascending order.

I want my set to be arranged in descending order. What changes should I make.

P.S. I dont want to change my Java Code.

Framework Used: Spring

ORM Used:Hiebrnate


Solution

  • I got the solution, use this

    order-by="commentId desc"