n00b n00b - 1 year ago 130
Java Question

DynamoDBMapper for java.time.LocalDateTime

I'm utilizing java.time.LocalDateTime in my java application. I'm also trying to use

and via the annotation save the
variable. Unfortunately I get the following error:

DynamoDBMappingException: Unsupported type: class java.time.LocalDateTime

Is there a way to have this mapping without using

Answer Source

Despite what I said I found it simple enough to use DynamoDBMarshalling to marshal to and from a string. Here is my code snippet and an AWS reference:

class MyClass {


    @DynamoDBMarshalling(marshallerClass = LocalDateTimeConverter.class)
    public LocalDateTime getStartTime() {
        return startTime;

    static public class LocalDateTimeConverter implements DynamoDBMarshaller<LocalDateTime> {

        public String marshall(LocalDateTime time) {
            return time.toString();

        public LocalDateTime unmarshall(Class<LocalDateTime> dimensionType, String stringValue) {
            return LocalDateTime.parse(stringValue);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download