Vote count:
0
I came across recently was trying to order a Hibernate Criteria Query by two columns of equal importance. Basically what I mean is, if I have a table where one column is a date (createdOnDate) and the other is a date (modifiedOnDate), I’d like to compare all dates in the orderBy clause from Organization object.
for this i tried like this:
session.createCriteria(Organization.class).addOrder(Order.desc("modified_date")).addOrder( Order.desc("created_date") );
But it is sorting all the organizations first based on the modified_date and then again it is sorting using created_date. This means a modified record could appear before any createdOn records, even if the createdOnDate is earlier.
I need sorting happens simaltaneously with created_date & modified_date.
Please help for this.
Thanks in advance.
asked 41 secs ago
Hibernate Criteria Query - Order by Two Columns Simultaneously
Aucun commentaire:
Enregistrer un commentaire