I created a Foo object with four fields f1, f2, f3 and f4.
In update.jspx for this object, I set the render = "false" attribute for the f1 field.
In the update method of FooController , before updating the object of the parameter foo , I extracted the old value from db and bound it to the parameter foo , as shown below, because we do not want the end user to update this field.
Foo fromDB=Foo.findFoo(foo.getId()); foo.setF1(fromDB.getF1()); foo.merge();
I can verify that the old value for f1 in the Foo object does not change after the update operation is complete.
This may be one of the ways to prevent users from updating some fields of the entity object and we hope that this approach will work for you.
Greetings
source share