Error with runtime, assosiation lies in the domain model

0
An error occurred while initializing the Runtime: Detected unique constraint violation. [association: DaadwerkelijkeApp.Voorraadpositie_Artikel, column: DaadwerkelijkeApp.ArtikelID
asked
2 answers
0

Check the domain model for module DaadwerkelijkeApp and check the entity ArtikelID by double clicking the entity.

Goto validation rules, there is a unique constraint defined on artikelID, remove the constraint, and after startup delete the artikel with a matching ArtikelID and re apply the validation rule.

 

Does this do the trick?

answered
0

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 (in this case Voorraadpositie_Artikel) to one-to-one. Mendix does not warn you about this change in association, but if there's even one Voorraadpositie object that has more than one Artikel 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. The new association will probably be named Voorraadpositie_Artikel_2 and a lot of errors might pop up, but you can rename the new association to Voorraadpositie_Artikel 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.

Let me know if this helped out anyone!

answered