[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-963) Dates comarison in query fails

Steve Ebersole (JIRA) noreply at atlassian.com
Mon Mar 21 13:00:30 EDT 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-963?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole closed HHH-963.
------------------------------


Closing stale resolved issues

> Dates comarison in query fails
> ------------------------------
>
>                 Key: HHH-963
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-963
>             Project: Hibernate Core
>          Issue Type: Bug
>    Affects Versions: 3.0.5
>         Environment: Hibernate 3.0x, HSQL
>            Reporter: Pavel Kaplin
>            Assignee: Steve Ebersole
>            Priority: Critical
>
> Expression like "date1 = date2" are being calculated incorrectly. When compared dates are equal, expression "date1 = date2" is false, but "date1 > date2" is true. It's not seems right.
> Try to use the following code in your Eg application:
>     Session session = factory.openSession();
>     Date date = new Date();
>     AuctionItem auctionItem = new AuctionItem();
>     auctionItem.setEnds(date);
>     session.save(auctionItem);
>     session.close();
>     session = factory.openSession();
>     Query query = session.createQuery("SELECT item FROM org.hibernate.auction.AuctionItem AS item WHERE item.ends = :date");
>     query.setDate("date", date);
>     List list = query.list();
>     System.out.println("Date = " + date.getTime());
>     System.out.println("AuctionItem.date = " + ((AuctionItem) list.iterator().next()).getEnds().getTime());
>     System.out.println("List size == " + list.size());
>     if (list.size() != 1) throw new RuntimeException ("AAAAAAAAAAAAAA!");

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list