having the below table
"CREATE TABLE IF NOT EXISTS user_preferences (" +
" user_id text," +
" my_duration duration," +
" last_modified timestamp," +
" primary key((id))" +
");";
when trying to persist the below model
import com.datastax.driver.mapping.annotations.Column;
import com.datastax.driver.mapping.annotations.PartitionKey;
import com.datastax.driver.mapping.annotations.Table;
import java.time.Duration;
@Table(name = "user_preferences")
public class UserPreferences {
@PartitionKey
@Column(name = "user_id")
private String userId;
@Column(name = "my_duration")
private Duration myDuration;
@Column(name = "last_modified")
private Date lastModified;
}
i get this codec not found exception.
com.datastax.driver.core.exceptions.CodecNotFoundException: Codec not found for requested operation: [duration <-> java.time.Duration]
at com.datastax.driver.core.exceptions.CodecNotFoundException.copy(CodecNotFoundException.java:57) ~[cassandra-driver-core-3.6.0.jar:na]
at com.datastax.driver.core.exceptions.CodecNotFoundException.copy(CodecNotFoundException.java:25) ~[cassandra-driver-core-3.6.0.jar:na]
at com.datastax.driver.mapping.DriverThrowables.propagateCause(DriverThrowables.java:39) ~[cassandra-driver-mapping-3.6.0.jar:na]
at com.datastax.driver.mapping.Mapper.save(Mapper.java:356) ~[cassandra-driver-mapping-3.6.0.jar:na]
NOTE: reading works fine probably because the table is not populated yet.
is java.time.Duration supported by Datastax-core 3.3.2 ?