I defined my registerDate field as a Date type, more specific, a java.util.Date, when i retrive data from database, it is fine:
but when i want to save it back to database: ps.setDate(7,user.getRegisterDate()); cannot compile it because it is not expected Date type, why is there no problem with the first statement. for the second statement, may i just simply cast its type? just like: ps.setDate(7,(java.sql.Date)user.getRegisterDate());
java.util.Date is like a timestamp, it stores date information as well as time information, whereas java.sql.Date is supposed to store only Date information, time information should have been set to 0 or whatever the equivalent of 0 should be. There is more information on that in the API docs.