This problem is a problem I encountered in my own development. The database uses mysql5.6 field name is checkingTime type is timestamp
It is obvious that what is stored in the library is to retain 6-bit milliseconds, i.e. yyyy-MM-dd HH:mm:ss.ssssss
At this time, the requirement is accurate to the same time as the same time is not stored
At this time, you need to search for a fuzzy query and search for Baidu. There is no good method.
My bean class defines the date type
Use annotations to change the type to timestamp to store in the library
In fact, when doing fuzzy query, you only need to pass String type parameters to the persistence layer.
My approach is to pass the "%" to the persistent layer after the normal parameter assignment is assigned, and then the left or right splicing "%" is passed to the persistent layer after the left or right or left is spliced.
I use native sql to directly query and pass your parameters
Through the test, you can query the required data normally
Summarize
The above is the method of springboot using JPA time type to fuzzy query that the editor introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to Wulin.com website!