When you encounter hibernate queries in your project today, the fields in the bean and the fields in the database do not match (there is a pagetime field in the bean, but there is no column in the database) to issue an error.
Specific problem Environment:
In the Auto_off table, the Off_time field is the bigint type, which holds the Unix timestamp, and the corresponding attribute type in the bean is type long, but the foreground pass time is a string type (2016-11-25).
Workaround 1:
Add a String type pagetime field to the bean, and then the data passed by the foreground is received using Pagetime, and the value is converted to a long type, at which point the query will be error when the project is started. The error message is: The field in the bean cannot find the corresponding column in the table. It is thought that a property of a class is not persisted in the database, so hibernate queries the database without letting it query the property.
To the conclusion of the search: You can add @transient annotations (javax.persistence.Transient) to the field so that hibernate does not query the field.
Transient annotation detailed explanation: http://www.importnew.com/12611.html
Workaround 2:
The method of approach 1 is a bit cumbersome and ultimately requires only a Unix timestamp, then the time on the page through the date control user selected, converted to a Unix timestamp sent to the background. (In fact, the start is not considered because in the background will automatically parse the parameters in request, according to the regular get parameter types, injected into the bean, build into query conditions, do not want to change this part)
// jquery DatePicker can only get to month day var timeval = $ (this). Val () + "00:00:00"; var New Date (timeval); var result = Math.Round (D.gettime ()/1000);
Record the field and database column type mismatch problems in Hibernate query bean