Ext.: http://crazycat03.iteye.com/blog/252784
Today encountered in HQL to select the time period of the data, time compared to a problem, through the Internet search and practice, summarized as follows:
String begindate = Request.getparameter ("Begindate");
String EndDate = Request.getparameter ("EndDate");
The above two data are obtained from the page and are of type string
HQL = "From A as model";
HQL + = "where model.proid= '" + "556655" + "'";
if (! Strutil.isblank (begindate)) {
HQL + = "and Model.signtime>=to_date ('" + begindate + "', ' yyyy-mm-dd HH:mi:ss ')";
}
if (! Strutil.isblank (EndDate)) {
HQL + = "and Model.signtime<=to_date ('" + EndDate + "', ' yyyy-mm-dd HH:mi:ss ')";
}
Or you can directly use between ... to ...
Just start, enter a, compare once no problem, but two data at the same time compare error, later in the client test, found that two less ' (single quotation marks), plus on the good, hehe, posted out, afraid of someone and I made the same mistake