I don't understood the error This is error
Stacktrace:] with root cause
com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Incorrect datetime value: 'com.model.User@67f56542' for column 'intime' at row 1
Constructor
public User(Date intime) {
super();
this.intime = intime;
}
This is code
User user = new User(new Date());
Configuration cfg = new Configuration();
cfg.configure("com/resources/config.xml");
SessionFactory sf = cfg.buildSessionFactory();
Session ss = sf.openSession();
Transaction tx = ss.beginTransaction();
Query q = ss.createQuery("update User set intime = '"+user+"' where email='"+email+"' ");
q.executeUpdate();
tx.commit();
ss.close();