The first time I used hibernate for persistence layer today, I had to admit that it was really easy to use and ignored a lot of things I had to worry about.
For example, if the connection is enabled and the SQL statement is disabledCodeVarious exception method calls, etc.
However, this kind of security is also caused by the uncontrolled underlying SQL statements.
Then, I used to process the date object declarations in the string type and then passed the SQL statement to_date (S, 'yyyy-mm-dd ')
What about now?
An exception occurred while changing the type.
Org. hibernate. Exception. dataexception: cocould not execute JDBC batch update
Caused by: Java. SQL. batchupdateexception: ORA-01861: text does not match the Format String
Obviously, the string cannot be directly inserted into the Date Field of the database.
Sorry, 00.
If you don't have any ideas, you can immediately change the date type to modify the corresponding ing file.
However, the assignment is hard to understand.
For example
Suppose I want to specify the insert date
If you can't do anything, you can't handle it.
Date =NewDate ();
I asked my colleagues, because the guy used the date type all the time before using JDBC.
We know that we can use the simpledateformat class to format string dates.
After reading simpledateformat, there is a parse (string) method that returns the date object!
NewSimpledateformat ("yyyy-mm-dd"). parse ("2008-10-25 ");
The SAVE () operation is successfully inserted!
Next, read the database.
However, it is required to print the data displayed from January 1, 1990 to January 3, September.
NewSimpledateformat ("yyyy-mm-dd"). Format (E. getinvoice_date ());
Display Results: October 1, 1990-October 3, September
Note: simpledateformat format (Object O); strings cannot be formatted directly.