Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Joda Time DateTimes in Predicate #123

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

Problem with Joda Time DateTimes in Predicate #123

thackel opened this issue Apr 3, 2012 · 4 comments

Comments

@thackel
Copy link

@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
Copy link
Member

@timowest 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
Copy link
Author

@thackel 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
Copy link
Member

@timowest timowest commented Apr 5, 2012

Ok, good to know, thanks for sharing.

@timowest
Copy link
Member

@timowest 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
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants