I have my entity as shown below
@Entity
@Table(name = "Contact")
@Data
public class Contact{
Long Id;
String phoneNumber;
@javax.validation.constraints.Email(message = "A valid email address is required")
private String emailAddress;
String type;
}
I am updating the type for the existing record from Contact
table
existing record
{
"phoneNumber":"1234567890";
"emailAddress":"testEamail"
"type":"1"
}
I am changing type to 2 with PATCH
request.
But I am getting error "A valid email address is required" as existing email is in valid format.
I can't change existing emailAddress.
Any idea how can I skip javax.validation
during update/PATCH
I am getting an error when we save existing contact in service class
service class code
Contact contact = contactRepository.getById(id);
contact.setType(2);
contactRepository.save(contact);