gonzao_diaz wrote:
Do you have a property returning the exact event_date, as a date?
A criteria query has to order by that, not by your string representation.
Unless you have already a getter called "getEvent_date" (I doubt it), the sorting is meaningless.
In general, HQL deals with properties, not fields.
In my mapping file, I have:
Code:
<property name="eventDate" column="event_date" type="java.lang.String" not-null="true"/>
In my class file, I have:
Code:
private String m_eventDate = "";
public String getEventDate() {
return m_eventDate;
}
public void setEventDate(String p_date) {
m_eventDate = p_date;
}
So I think I got it working with this:
Code:
HibernateUtils.getSession().createCriteria(EventLocator.class).addOrder( Order.asc("eventDate") ).list();
Thank you so much for your help!