44import com .j256 .ormlite .field .DataType ;
55import com .j256 .ormlite .field .DatabaseField ;
66import com .j256 .ormlite .table .DatabaseTable ;
7+ import java .util .Date ;
78import java .time .Instant ;
89import java .util .UUID ;
910
@@ -17,26 +18,27 @@ class UserTable {
1718 private String name ;
1819
1920 @ DatabaseField (columnName = "last_seen" , dataType = DataType .DATE_STRING )
20- private Instant lastSeen ;
21+ private Date lastSeen ;
2122
2223 @ DatabaseField (columnName = "account_created" , dataType = DataType .DATE_STRING )
23- private Instant accountCreated ;
24+ private Date accountCreated ;
2425
2526 UserTable () {
2627 }
2728
28- UserTable (UUID uniqueId , String name , Instant lastSeen , Instant accountCreated ) {
29+ UserTable (UUID uniqueId , String name , Date lastSeen , Date accountCreated ) {
2930 this .uniqueId = uniqueId ;
3031 this .name = name ;
3132 this .lastSeen = lastSeen ;
3233 this .accountCreated = accountCreated ;
3334 }
3435
3536 User toUser () {
36- return new User (this .uniqueId , this .name , this .lastSeen , this .accountCreated );
37+ return new User (this .uniqueId , this .name , this .lastSeen . toInstant () , this .accountCreated . toInstant () );
3738 }
3839
3940 static UserTable from (User user ) {
40- return new UserTable (user .getUniqueId (), user .getName (), user .getLastSeen (), user .getAccountCreated ());
41+ return new UserTable (user .getUniqueId (), user .getName (), Date .from (user .getLastSeen ()),
42+ Date .from (user .getAccountCreated ()));
4143 }
4244}
0 commit comments