I am using datastax java driver with mapperd
I want to save epoch as timestamp
device_id | timestamp
--------------------------
2323 | 1595077868994000
122112 | 2020-07-25 05:30:00.000000+0000
Currently I am using ZonedDate time.. But when I insert record via java code it saves as epoch as shown in Row number 1
insert into table (device_id , timestamp ) VALUES ('122112',toTimestamp(toDate(now()))) ;
However when I insert with query as above it stored timestamp in more readable format How can I configure datastax driver to store timestamp in readable format
Here is my entity
public class Table {
@PartitionKey(value = 0)
private String deviceId;
private Instant timestamp;
Instant was only one which had codec to Timestamp.. I just want to store Timestamp to DB at milli sec accuracy and want it easily readable on UI
THen I am using Object Mapper , Dao and the just calling Save method
@Dao
public interface TableDao {
@Insert
boolean save(Table table);
}
timestamp
column not oftimestamp
type? If not, this is a good reason why it should be. – Aaron