davidjanmercado / sqlite-jdbc

Automatically exported from code.google.com/p/sqlite-jdbc
Apache License 2.0
0 stars 0 forks source link

Date problem #29

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi. I use this lib with JPA 2, and 
@Entity
...
    @Column(name = "date")
    @Temporal(TemporalType.DATE)
    private Date createdDate;
getDate(); - return normal value

but setDate(new Date()); write null to db 
setDate(new Date(System.currentTimeMillis())); write ~o_O to db 
and getDate(); after write to db not work, need manually look to db with some 
programs and remove broken record... then work getDate(); again;
and if write setDate(new Date(System.currentTimeMillis())); then change from 
Date to String getDate(); private String createdDate; - returned value 
1233565546 currentTimeMillis - and another normal data dates like "2012-10-10 
10:10:10" 

in db
CREATE TABLE comingsofinvoicesongoods (
  id              integer PRIMARY KEY AUTOINCREMENT NOT NULL,
  "date"          datetime DEFAULT CURRENT_TIMESTAMP,
  invoiceid       varchar(80),
  counterpartyid  integer,
  storehouse      integer,
  info            text
);

Original issue reported on code.google.com by sp.titan on 13 Jul 2012 at 11:29