Error while trying to run app.

0
When using Mendix Studio Pro, everytime I try to run the app, it says something went wrong and that I have to wait and try again or contact mendix support. This is the error message that is posted, “An error occurred while initializing the Runtime: Detected unique constraint violation [entity: MyFirstModule.Course, attribute: Title] Since Mendix 9, only Database Uniqueness Validation is supported. If your project still uses Runtime Uniqueness Validation, please contact support.” What am I supposed to do now?
asked
2 answers
3

Hey Angelique,

 

Just wanted to add my two cents, as I was experiencing the same error. It might help out others that stumble upon this topic in the future.

The error usually happens when Uniqueness validation is set to “Database” (in the runtime configuration) AND someone changed a one-to-many association to one-to-one. Mendix does not warn you about this change in association, but if there's even one  object that has more than one  objects linked to it in the database, the error will prevent your application from starting (both locally and in the cloud).

There might be more causes than just this one, but it seems the most likely cause in my opinion.

How to fix?

You could choose to manipulate the database manually, but perhaps a safer way is to simply remove the association altogether and create a new one. After the new association, probably  lot of errors might pop up, but you can rename the new association (back to what you deleted) again to get rid of these errors. The only thing you'll need to correct are any access rules that you had set up for the association.

Hope it helps!

answered
1

Hi Angelique,

Check whether you have applied Title as unique in the course entity, if so remove this and run app again. After this you can find and remove duplicate titles and you can set title unique again.

answered