Reputation: 34
I am new to JSF+Hibernate and needs some help.
I have a Users table:
| Id | FirstName | LastName | Password |
I have a User form that updates the FirstName and LastName and another form to update the Password.
The issue I am having is that since the password field is not present in the User form, it gets updated to NULL on update.
I want the User form to ignore the Password field. Right now I set the Password field to Transient, but now that prevents the Password from being updated in the Password form because it is not persistence.
What is best practice or is there a good solution. Anything helps. Thanks
Upvotes: 0
Views: 178
Reputation: 2288
The first this that comes up is: do not map the fields from your form directly to the entity fields. Use fields in your controller and update the first and the last names in the User entity during save operation.
However I do not understand why absents of the password field on your form should make the appropriate entity field to be updated to NULL. Some code would help
Upvotes: 0