Sleep mode does not save milliseconds

I save the object in sleep mode with creation date       

    @Id
    @Column (name = "dtcreation")
    @Type (type = "timestamp")
    private Date creation;
and I put a new date in this field:   
    entity.setCreation (new Date ());
    entityDao.persist (entity);
but when it is stored on db, the time does not contain milliseconds, but put it to 0 if I try to update the value of milliseconds with the request, it works ... can someone help me?

after the persist method, I have a record from 06/01/2011 15: 00: 00.0 but if I did UPDATE, I can change the milliseconds, so db supports it. the database is informix

+5
source share
2

java.util.Date java.sql.Timestamp

java.util.Date , java.sql.Timestamp - SQL. javadoc Timestamp, .

(, Joda), java.sql.Timestamp milisecond

java.util.Date date = new java.util.Date();
java.sql.Timestamp timestamp = new java.sql.Timestamp(date.getTime());
entity.setCreation(timestamp);
+8

, , , , Javadoc java.sql.Timestamp, , . java Date Timestamp , .

0

All Articles