Problem with Joda Time DateTimes in Predicate #123

Closed
thackel opened this Issue Apr 3, 2012 · 4 comments

Comments

Projects
None yet
2 participants
@thackel

thackel commented Apr 3, 2012

Is there a problem when creating predicates with joda time types?

QOrganization.organization.createdDate.eq(new DateTime())

fails with:

Parameter value [2012-04-03T15:20:53.173+02:00] did not match expected type [java.util.Date

createdDate is of field DATE and accessors are DATETIME, JPA access is field access

Complete sample is here:

https://github.com/thackel/QueryDSLTestCase

timowest added a commit that referenced this issue Apr 3, 2012

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Apr 3, 2012

Member

createdDate is now correctly reflected as a java.util.Date type in the query class.

Alternatively you could also use Hibernate's Joda support to have both the field and getter use DateTime.

Member

timowest commented Apr 3, 2012

createdDate is now correctly reflected as a java.util.Date type in the query class.

Alternatively you could also use Hibernate's Joda support to have both the field and getter use DateTime.

@thackel

This comment has been minimized.

Show comment
Hide comment
@thackel

thackel Apr 5, 2012

Just for others which may also experience the same problems: have to stick with fieldaccess and want jodatime classes instead of java.util.Date in their predicates:

http://usertype.sourceforge.net/

This is the most recent effort of JodaTime Usertypes for Hibernate.

thackel commented Apr 5, 2012

Just for others which may also experience the same problems: have to stick with fieldaccess and want jodatime classes instead of java.util.Date in their predicates:

http://usertype.sourceforge.net/

This is the most recent effort of JodaTime Usertypes for Hibernate.

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Apr 5, 2012

Member

Ok, good to know, thanks for sharing.

Member

timowest commented Apr 5, 2012

Ok, good to know, thanks for sharing.

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Apr 20, 2012

Member

Released in 2.5.0

Member

timowest commented Apr 20, 2012

Released in 2.5.0

@timowest timowest closed this Apr 20, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment