Adding unique check and showing custom message on violation of the unique check

I have added a unique column and added message for violation check
IDX_APPOLL_USER_DETAILS_UNIQ_PHONE_NUMBER = Phone number already exists
in message.properties of web, portal and core modules but not getting this message.

In the log i am getting
"Caused by: org.eclipse.persistence.exceptions.DatabaseException:
Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicata du champ ‘9538578696’ pour la clef 'IDX_APPOLL_USER_DETAILS_UNIQ_PHONE_NUMBER’
Error Code: 1062"

and in the postman I am getting
"{
“error”: “Server error”,
“details”: “”
}"

these messages.
but I want to show “Phone number already exists” as message to end user
Currently using cuba 6.8.2

Hi,
Could you please tell what database type you have specified in the project properties?

We are using mysql database

Please, update platform version at least to the 6.8.3 version. Also, check, that the message for violation check is placed in the main message pack.

We are using platform-6.8.7

It seems that you have a non-English locale enabled for your DB. In this case, you should provide a value for the cuba.uniqueConstraintViolationPattern application property. This property allows you to define a reaction to unique constraint violations depending on a DBMS locale and version.

@firstova : Where do I change the DBMS locale? in the studio or gradle?

image

my setting in gradle file looks like this
task createDb(dependsOn: assembleDbScripts, description: ‘Creates local database’, type: CubaDbCreation) {
connectionParams = ‘?useSSL=false&allowMultiQueries=true’
dbms = ‘mysql’
host = ‘localhost’
dbName = ‘fieldbuzztest’
dbUser = ‘shanur’
dbPassword = ‘shanur’
}

The DBMS locale is not the Cuba setting, it is set in your SQL Server.

I’m using HSQLDB and have English and Spanish locales enabled in the project properties, where should I add the personalized message? I have them inside the main message pack but it isn’t working.