I have a problem comparing dates with oracle, and i don't know how can I compare dates in the hql sentence.
I Put the source code:
Date iniDate = getIniDate(); //this obtains date in Spanish format: DD/MM/YYYY HH:mm:ss for example: 14/11/2006 10:00:00
Date endDate = getEndDate(); //this obtains date in the same format. For example: 15/11/2006 12:00:00 (In The database the dates are in the spanish format too)
//I want to obtain the Users born between these dates. I do this:
session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
Query query = session.createQuery("from User where birddate>=? and birddate<?");
query.setParameter(0, iniDate);
query.setParameter(1, iniDate);
List lst = query.list();
This not obtains only the users born between this dates. Why?
I know that I can obtain all the users, get the birddate and then compare it, but I have a lot of registers, and I think this is a dirty solution.
How can obtain only the registers between 2 dates?
_________________ -Blaine-
|