Ignore null values of entity bean while updating the table using Hibernate
hibernate, java
Solution
hibernate-dynamic-update
The dynamic-update attribute tells Hibernate whether to include unmodified properties in the SQL UPDATE statement.
Problem
Stuck on the same problem Is there any method to ignore `null` values when updating the database in `Hibernate`? Whenever you call update(); of Session, it will also update the null values found in the object. Example: ``` User user = new User(); user.setUserId(5); user.setUserName("Maarten"); user.setUserFirstName(null); // but in database this value is not null session.update( user); ``` OR ``` session.saveOrUpdate( user); ``` The DB will now update the user, but will set the user firstname to null (because it is null in the object). Is there any way or method in Hibernate to avoid this (I don't want to fire a select/ update query to set the bean)? that it will ignore the null value?