Jrcastro Ribeiro wrote:And thats the method im using:
You should of course use the correct syntax in your JPQL query. If you are using the BETWEEN operator, it should be something likeAnd you should set both parameters as well using setParameter. And you should of course use the appropriate parameter names as well! In your query you are using :date so you should query.setParameter("date", date); (and not using "names" as the first parameter)
I would expect to see something likeAnd a similar condition if you want to check the endDate as well
Using Mysql
But I cannot relate these two columns to show the objects that begin on startDate and ends at endDate ?
My idea was to have two text fields, one that would receive the end date and another with the start date, passing as parameter values, and then returning a list of objects with the relatives dates
Jrcastro Ribeiro wrote:Here the SS, seem to be working
Maybe you should verify your results a little bit better and with greater eye for detail before claiming it is working!
Jrcastro Ribeiro wrote:Something like that?
And date 1 and date 2 are the parameter
Yes! And depending if the dates should be included you use >= (included) or > (not included). But don't use string concatenation! Use parameter placeholders insteadAnd then use
Jrcastro Ribeiro wrote:But same problem =/ , really don't know what is wrong.
Very weird! Should normally work without any problem. If you google for "jpql date less than", you'll see this solution is used each time.
Just to be sure: can you try qualifying the properties in your JPQL query and add space before comparison operators? So using u.startDate >= :date1 and u.endDate <= :date2.
If it doesn't work, please share the stack trace as well.
Jrcastro Ribeiro wrote:But same problem =/ , really don't know what is wrong.
Very weird! Should normally work without any problem. If you google for "jpql date less than", you'll see this solution is used each time.
Just to be sure: can you try qualifying the properties in your JPQL query and add space before comparison operators? So using u.startDate >= :date1 and u.endDate <= :date2.
If it doesn't work, please share the stack trace as well.
i dont know why I never see those little mistakes hehe, I was forgetting to put u.starDate, Now its working like a charm on the jtable.