File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes hibernate criteria with equals for date fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "hibernate criteria with equals for date fields" Watch "hibernate criteria with equals for date fields" New topic
Author

hibernate criteria with equals for date fields

Michael Sampson
Ranch Hand

Joined: Sep 24, 2008
Posts: 30
Maybe someone knows something about this but if not maybe just typing my question out could help resolve this either way here it goes...
So I am working with Oracle database that has a date field that will have date down to hours, minutes, seconds, not just year, month, day. Now for my domain object I have this:
class Group {

@Column(name="START_DATE")
@Temporal(TemporalType.TIMESTAMP)
private java.util.Date startDate;
}

OK .... never mind I figured it out. So the deal is even though I have it as type Date in the domain object, in the criterial statment I cannot do this:

I have to do this:

It turns out that really a time stamp. Not a date. That was about a day's worth of work gone.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: hibernate criteria with equals for date fields