Giter Club home page Giter Club logo

Comments (5)

hanshuo-aws avatar hanshuo-aws commented on May 29, 2024

Hi tnatarajan,

This is actually an intended behavior, as described in javadoc for save operation:

For updates, a null value for an object property will remove it from that item in DynamoDB.

So for your case, one possible solution would be to use a trimmed domain class that doesn't model the attributes that are expected to remain unchanged.

Considering that this is rather an inconvenient workaround, yet it is still very important for us to avoid any changes that could break existing customers' code, we are thinking of providing a third option for SaveBehavior (something like UPDATE_IGNORE_NULL_ATTRIBUTES), which would force the save operation to NOT remove null-valued attributes.

By doing it, we could both support the desired "partial" UPDATE and keep our code as backward-compatible. What do you think?

Thanks.
-Shuo

from aws-sdk-java.

tnatarajan avatar tnatarajan commented on May 29, 2024

Hi Shuo,
Thanks for clarification, that's good to know. It will be great if we have that new SaveBehavior.

Thanks, Thiru

from aws-sdk-java.

wmatveyenko avatar wmatveyenko commented on May 29, 2024

Just letting you know that the latest version 1.5.3 includes a new SaveBehavior. From the release notes:
The high-level DynamoDBMapper class now supports a new SaveBehavior strategy, called UPDATE_SKIP_NULL_ATTRIBUTES. This new SaveBehavior is very similar to the existing UPDATE strategy. The only difference is that any attributes sent with null values will not be removed from the item in DynamoDB.

from aws-sdk-java.

hanshuo-aws avatar hanshuo-aws commented on May 29, 2024

Correction: UPDATE_SKIP_NULL_ATTRIBUTES is available in 1.5.4, not in 1.5.3:
http://aws.amazon.com/releasenotes/Java/2365482772829983

from aws-sdk-java.

wmatveyenko avatar wmatveyenko commented on May 29, 2024

Oops, sorry about that! Thanks @hanshuo-aws!

from aws-sdk-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.