When I write SQL statement to insert data in the database (not to time field to insert data), save, time field can automatically gets the current time,
Now I'm going to input data from the page, find the data in database can only be inserted into the page me, time field for the database is not automatically gets the current time,
Second, if I had written in SQL statements, couldn't query page query, will quote this wrong:
Org. Springframework. Orm. Hibeenate3. HibernateSystemException. Illegal ArgumentException occurred while calling the setter of com. Xx. Nested exception is org. Hibernate. PropertyAccessException: IllegalArgumentException occurred while calling the setter of... ...
Then I am using struts 2, hibernate3.2 spring3 framework for integrating the configuration file is used for the mapping of the entity class, because there is also a page need to query time, so the time property in the Java entity class, I wrote a String,
Foreground from background to obtain the json data, and then to reality on the page,
My present situation is: there is no time table to add and delete fields can success, just above the no,
Who can give me think it over, I have been stuck for two days, is born is love!!!
Baidu, blogs I go, but no real solution, before I tried to modify. HBM. XML file, add type="Java. SqlTimestamp gwnerated"="insert", was a success at the beginning, but I forgot to backup, and then I again we will continue to improve the project error, found that even the same, time field can automatically obtain the data of table
CodePudding user response:
Problems have been solved, for a few days, really is drunk, the type of time repeatedly changed in the Java String and Timestamp, and testing, the HBM. The XML type and generate not delete, add, and do not modify, finally finally succeeded,Is my first setup: database time field is set to: timestamp, and set to CURRENT_TIMESTAMP, when you don't check the update current timestamp (if you want to let the data change, time also changes, you can check), the time field types in the Java entity class to a String, the HBM. XML, & lt; The property name="sbudate colom"="subdate & gt;" Modified to & lt; The property name="sbudate generated"="insert" colom="subdate & gt;" Remember, don't again behind the field with type="Java. SQL. Timestamp", will quote the field type is not legally wrong, I just be online answer pit, hasn't been deleted type, so has been failure, just on the first, when I have time, I would write the blog