# How to prevent Hibernate from updating column values as null in a PUT web request when the entity uses @DynamicUpdate

**URL:** <https://discourse.hibernate.org/t/how-to-prevent-hibernate-from-updating-column-values-as-null-in-a-put-web-request-when-the-entity-uses-dynamicupdate/1988>\
**Category:** Hibernate ORM\
**Created:** [January 8, 2019, 12:41pm UTC](https://discourse.hibernate.org/t/how-to-prevent-hibernate-from-updating-column-values-as-null-in-a-put-web-request-when-the-entity-uses-dynamicupdate/1988 "2019-01-08T12:41:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![vlad](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/vlad/32/658_2.png) [@vlad](https://discourse.hibernate.org/u/vlad)\
**Post date:** [January 8, 2019, 1:21pm UTC](https://discourse.hibernate.org/t/how-to-prevent-hibernate-from-updating-column-values-as-null-in-a-put-web-request-when-the-entity-uses-dynamicupdate/1988/2 "2019-01-08T13:21:31Z")

</div>

Unlike a POST, where you can reconstruct the entire entity snapshot when using PUT, you need to specify what property you want to update.

Now, in a `@Transactional` method, you need to:

1. Fetch the entity: `Post post = entityManager.find(Post.class, postId);`

2. Set the entity property using the value you submitted via PUT: `post.setTitle(title);`

If you want to make it dynamic, you can use Java Reflection to set the entity property by matching the provied proeprty name.

When the current transaction is committed, a flush will occur and propagate the entity property change to the database.

That’s it.

---

_[View the full topic](https://discourse.hibernate.org/t/how-to-prevent-hibernate-from-updating-column-values-as-null-in-a-put-web-request-when-the-entity-uses-dynamicupdate/1988)._
