Hello guys :)
I'm kinda new in hibernate and I experience some little problems with it
however this is because of my lack of knowledge :)
but the problem that badgers me is the differences between the data types
so I'm using hibernate 3.2.1
and MySQL 5.0 on FreeBSD
I have a table looking like this
describe the_table;
+------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------------------+------+-----+---------+----------------+
...
...
| bse_date | datetime | YES | | NULL | |
...
...
the documentation of MySQL says that this type "datetime" reflects the java.sql.Timestamp
so I've mapped it like this
Code:
private Timestamp bseDate;
I have some values in this table and I wanna make some updates
when I select some rows I can see this column showing me date and time like this:
2007-01-25 11:31:42
this is correct
after I do this kind of update:
Code:
Query updateQuery = session.createQuery("update TheTable t set t.BseDate = :bseDate where t.Idr = :id");
Timestamp ts = new Timestamp(new Date().getTime());
updateQuery.setDate("bseDate", ts);
updateQuery.setLong("id", 2824198);
updateQuery.executeUpdate();
session.flush();
and when I select the updated row I get this date
2007-01-25 00:00:00
the hours, minutes and seconds are gone
this is bad for me :)
how can I play with the types to get this working correct ?
thank you