datetime « Field « JPA Q&A

1. Compare time part of datetime field in Hibernate

I've got an application that uses a hibernate(annotations)/mysql combination for ORM. In that application, I got an entity with a Date field. I'm looking for a way to select on that ...

2. NHibernate:HQL: Remove time part from date field

I'm trying to group table values by date, and this HQL query works fine:

 SELECT  af.SubmitedDate, COUNT (af.Id) 
 FROM ApplicationForm af 
 GROUP BY af.SubmitedDate
The problem is that field ...

3. Distinct DateTime field without Time in HQL

I'm trying to select Distinct DateTime field in HQL.

select distinct CreatedDate from ClaimFile order by CreatedDate DESC
Any Idea how can I get distinct dates without time. right now it can't be ...

4. How to create an auto-generated Date/timestamp field in a Play! / JPA?

I'd like to add a Date/DateTime/Timestamp field on an entity object, that will be automatically created when the entity is created/persisted and set to "now", never to be updated again. Other use ...

5. Problem while sorting datetime field based on date alone

I have a date object in the bean class called "dateTime" which contains both date and time. When I list the records of that bean class I am saying criteria.addOrder(Order.desc("dateTime")); This will sort based on date as well as the time. But I want the sorting only based on date not by time. Is there a way to do this in ...

6. HQL for datetime field

Hello folks I need to get only the date part of a DateTime field in the database using HQL. is that possible? For example: All records of today. The problem is that records in tha database is compost of Date and Time. My map to this field is: Thanks

7. Error set datetime field

Hi, I'm a total newbie to Hibernate so please bear with me. I'm reading a datetime datatype field from a Sybase database and it is not being cast correctly according to Hibernate. I've looked elsewhere for casting examples between the datetime field and other date definitions and have come up empty handed. The definitions and error message follow: VendorEntity.hbm.xml def for ...