• Post Reply Bookmark Topic Watch Topic
  • New Topic

JPA - Add criteria to query of LocalDate  RSS feed

 
Atul More
Ranch Hand
Posts: 67
1
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am working on a project and as per my requirement, I want to execute a query using JPA(Hibernate implementation is behind).
I have added a criteria of LocaDate ro query, but dont know the query is not executing.
Even it is not showing any error.
I have created a converter classes which can convert sql date to localDate and vise a versa but not working.


Does anyone has any idea?


Atul
 
L Foster
Ranch Hand
Posts: 242
14
Android Angular Framework AngularJS Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Atul.

You might wish to post some code, so we can see what is going wrong.  The problem could be anywhere. But I would absolutely make sure that the value you think is going into the query actually is.  I would also want to make sure the contents of the database really are going to give you a match. I say so, because if the query took place, and found no matches (where none exist), it would not be an error, just zero results.

BTW, when I did a little project for this about a year and a half ago, I did not have to put a date into the criteria query.  Instead I just used a "getTime()" off the date that I had formed up for the query.  I wound up using a method, as well, because I was worried about trying to query too close to a specific date (I had a full time stamp in use).

I hope that helps.
 
Atul More
Ranch Hand
Posts: 67
1
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for response.
Solved it
There was a mistake in my code.

You can add criteria of LocalDate, JPA2.1 supports it.


Thanks,
Atul
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!