Thank u so much for your help
The issue is fixed.It was because the value that was getting saved had lot of extra spaces .Now when i trim the value and enter in the DB i dont get any constraint violation.