Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8464399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:44:01+00:00 2026-06-10T14:44:01+00:00

I need to annotate a class that has a Set<UUID> property. Marshalling a scalar

  • 0

I need to annotate a class that has a Set<UUID> property. Marshalling a scalar UUID is fine, and I can use the @DynamoDBMarshalling annotation to specify my converter, and everything works.

When trying to use the same converter on a Set<UUID>, I get “DynamoDBMappingException: Expected SS in value”. I’ve tried creating a custom converter that expects Set<UUID>, but the same problem persists.

Is it possible to custom-marshall Sets?

@DynamoDBTable(tableName="djones-test")
public class UUIDRecommendation {
    private UUID id;
    private Set<UUID> recommendations;

    @DynamoDBHashKey
    @DynamoDBMarshalling(marshallerClass=UuidConverter.class)
    public UUID getId() {
        return id;
    }

    public void setId(UUID id) {
        this.id = id;
    }

    //Neither this nor UuidConverter.class work here    
    @DynamoDBMarshalling(marshallerClass=SetUuidConverter.class)
    public Set<UUID> getRecommendations() {
        return recommendations;
    }

    public void setRecommendations(Set<UUID> recommendations) {
        this.recommendations = recommendations;
    }
}

Here’s the stack trace:

com.amazonaws.services.dynamodb.datamodeling.DynamoDBMappingException: Expected SS in value {SS: [1a841b97-ab9d-4425-a2c0-f9a81bebf0b4, 1a841b97-ab9d-4425-a2c0-f9a81bebf0b4, 1a841b97-ab9d-4425-a2c0-f9a81bebf0b4], } when invoking public void com.company.model.UUIDRecommendation.setRecommendations(java.util.Set)
    at com.amazonaws.services.dynamodb.datamodeling.SUnmarshaller.typeCheck(SUnmarshaller.java:26)
    at com.amazonaws.services.dynamodb.datamodeling.DynamoDBMapper.setValue(DynamoDBMapper.java:329)
    at com.amazonaws.services.dynamodb.datamodeling.DynamoDBMapper.marshallIntoObject(DynamoDBMapper.java:302)
    at com.amazonaws.services.dynamodb.datamodeling.DynamoDBMapper.load(DynamoDBMapper.java:253)
    at com.amazonaws.services.dynamodb.datamodeling.DynamoDBMapper.load(DynamoDBMapper.java:196)
    at com.mendeley.service.data.DynamoRecommendedItemsDataServiceTest.testObjectMapper(DynamoRecommendedItemsDataServiceTest.java:65)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:44:02+00:00Added an answer on June 10, 2026 at 2:44 pm

    Oh dear – looks like customer marshallers of sets is unpossible. The AWS SDK is hardcoded to only deal with single string values (SUnmarshaller()).

    DynamoDBReflector in AWS SDK 1.3.13, line 185:

    if ( isCustomMarshaller(getter) ) {
        unmarshaller = new SUnmarshaller() {
    
            @Override
            public Object unmarshall(AttributeValue value) {
                return getCustomMarshalledValue(toReturn, getter, value);
            }
        };
    }
    

    UPDATE

    As an utterly filthy hack, I’ve cobbled something together that works by copy/pasting the entire class 🙁 This is why private static final utility services are bad, and dependency injection is good.

    This will work so you can use one customer converter (UuidConverter in my case) for getters that return UUID instances, or Set<UUID> instances.

    I added a method called getCustomMarshalledValueSet, which iterates over the List returned by value.getSS(), calls the custom marshaller for each, and adds the result to a Set which it returns.

        @SuppressWarnings({ "rawtypes", "unchecked" })
        private <T> T getCustomMarshalledValueSet(T toReturn, Method getter, AttributeValue value) {
        DynamoDBMarshalling annotation = getter.getAnnotation(DynamoDBMarshalling.class);
        Class<? extends DynamoDBMarshaller<? extends Object>> marshallerClass = annotation.marshallerClass();
    
        DynamoDBMarshaller marshaller;
        try {
            marshaller = marshallerClass.newInstance();
        } catch (InstantiationException e) {
            throw new DynamoDBMappingException("Couldn't instantiate marshaller of class " + marshallerClass, e);
        } catch (IllegalAccessException e) {
            throw new DynamoDBMappingException("Couldn't instantiate marshaller of class " + marshallerClass, e);
        }
    
        Set<T> set = new HashSet<T>();
    
        for (String part : value.getSS()) {
            set.add((T) marshaller.unmarshall(getter.getReturnType(), part));
        }
    
        return (T) set;
    }
    

    Additionally getArgumentUnmarshaller was changed to bring the isCollection check before the conditional to decide what type of unmarshaller to use, and changed the custom marshaller block to pick the right sort.

                if (isCustomMarshaller(getter)) {
                    if (isCollection) {
                        unmarshaller = new SSUnmarshaller() {
    
                            @Override
                            public Object unmarshall(AttributeValue value) {
                                return getCustomMarshalledValueSet(toReturn, getter, value);
                            }
                        };
                    } else {
                        unmarshaller = new SUnmarshaller() {
    
                            @Override
                            public Object unmarshall(AttributeValue value) {
                                return getCustomMarshalledValue(toReturn, getter, value);
                            }
                        };
                    }
    
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<context:annotation-config/> <context:component-scan... this is used for class that i need to annotated with @Repository
I have an annotation @MyAnnotation and I can annotate any type (class) with it.
The problem is that I need to create in runtime a class like this:
I have a class that has more than a dozen properties. For most of
I have few classes that I need to annotate with a name so I
For one subject in college I need to use Windows Azure . Notice that
I need to know how can I set Hibernate (...) to achieve the following
I need to annotate an image with Chinese Text and I am using Imagick
Need help with a query that I wrote: I have three tables Company id
Need to set some attributes of button. For example Checked. I guess it is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.