How to automatically set timestamp in room SQLite database?
问题 I am trying to have SQLite create automatic timestamps with CURRENT_TIMESTAMP. I took the liberty of using Google's code: // roomVersion = '2.2.2' @Entity public class Playlist { @PrimaryKey(autoGenerate = true) long playlistId; String name; @Nullable String description; @ColumnInfo(defaultValue = "normal") String category; @ColumnInfo(defaultValue = "CURRENT_TIMESTAMP") String createdTime; @ColumnInfo(defaultValue = "CURRENT_TIMESTAMP") String lastModifiedTime; } @Dao interface PlaylistDao {