Is there any command to ignore empty values when updating the database?
Whenever you call update(); of Session, it will also update the null values found in the object.
Example:
Code:
User user = new User();
user.setUserId( 5);
user.setUserName( "Maarten");
user.setUserFirstName( null);
session.update( 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 to avoid this? that it will ignore the null value?
I am temporarely fetching the user from the DB now and filling the object with already existing values, but this is one select statement to much tbh.
Thanks