1418
Views
10
Comments
 Problem creating entities (Foreign Keys)
Question

Hello everyone.


I'm having a problem creating entities that never happened to me.


I don't know why, but when I add two attributes of type user identifier to my entity and I try to publish I run into a error.


I already deleted the module and created a new one. I created a new entity and added attributes one by one and testing one by one. When I try to publish the second User identifier attribute to the entity I get the error:


"Upgrade Error
Could not create foreign key constraint. This may have happened because there are 'UpdatedBy' values of entity 'Suppliers' with no corresponding value in entity 'User', or attribute 'UpdatedBy' of entity 'Suppliers' is creating a circular dependency between entities. Check the Error Log for more information."


See the attachment to more details


Notes: 

1- In this module, there were more entities and all of them with these attributes. I had no problem publishing any of them. The error started out of nowhere and I can't understand why.

2- The tests were done on a new module within the same application. In the new testing module (attachment) I changed all the names


Thank you


ErrorPublishing.png
2019-05-22 11-30-09
Marcelo Ferreira

Hi Pedro,

Which version are you using? Can you share an example module that you can't publish.

Regards,

Marcelo

2017-08-13 19-08-40
Pedro Antunes

Hello Marcelo

I´m using version (10.0.1009.0)

I just create a module and one entity. And do not work.

The environment that I´m using is from a company. I´m not allowed to share OML :(

Thanks


2019-05-22 11-30-09
Marcelo Ferreira

Hi Pedro,

Looks that everything is ok. And I can't test it on that specific version. Your best bet is contact support here

Regards,

Marcelo

2020-02-28 09-46-54
Eduardo Jauch

Hi Pedro, 

I just published an entity with two User Identifiers attributes, both on O10 and O11 and it just worked.
No problems at all...

Can you give a little more detail on the process? There is data? A bootstrap? 

Cheers.

2017-08-13 19-08-40
Pedro Antunes

Demon things happen :)


As a last resort, I changed the type of user identifier attributes to any other type (The types were automatically given by the platform). I put it back again to User Identifier and it works :). Weird...


Thank you Eduardo and Marcelo

2020-02-28 09-46-54
Eduardo Jauch

Cool, it is solved.
Sad we don't know why... :( 

I bet it was a problem with Service Studio... Sometimes it gets a little "wow" and needs to be restarted... rs

Cheers.

UserImage.jpg
Thirupathi Rao Veerla

This happens frequently when I do solution publish or publish using lifetime from between environments. Its very hard to understand what is going wrong, but on multiple retries (painful) of deployments, it works (no guarantee it works or fails. Its adding risk to run short window deployments)


Could not create foreign key constraint. This may have happened because there are 'UpdatedBy' values of entity 'Disclosure' with no corresponding value in entity 'User', or attribute 'UpdatedBy' of entity 'Disclosure' is creating a circular dependency between entities. Check the Error Log for more information.
UserImage.jpg
mun hou loke

In case any one is still looking at this issue and can't find a solution, can refer to this link

I have a same issue, for my case, it's because some process is locking the "User" entity, when i'm trying to create a new table with foreign key to "User" entity and publish, the error occur. Can ask DBA to clear the session that locking "User" entity and try to publish again. 

UserImage.jpg
Sheila Jiménez Nieto

Hello,

I was creating the Data Base for a Gyms application, I was trying to create the relationship between Gyms and Classes taken place there, one Gym many Classes, one Class belongs to one Gym, so the foreign key GymId had to be in Classes table, and making this relationship gave me this error:

Upgrade Error 
Could not create foreign key constraint. This may have happened because there are 'GymId' values of entity 'Classes' with no corresponding value in entity 'Gyms', or attribute 'GymId' of entity 'Classes' is creating a circular dependency between entities. Check the Error Log for more information. 

I tried everything told above by the Community, but nothing worked in my case, and my data base was okey, no records in the tables, so no problems with empty fields having a referenced foreign key to another table. 

The only thing that worked for me was to delete the entity Classes which had the foreign key GymId and create the same exact table again (it worked by copy-paste, just copy your current table Classes (in your case the table that holds the foreign key) and paste it in the same data base space, and it creates Classes2, delete Classes and keep Classes2, after deleting the first one, change the name of Classes2 into Classes and try to create the relationship again).

Hope it works! Try everything you read!

Regards! :)

2019-01-03 11-28-50
Silvio Garbes Lara

For me the solution is set "Ignore" in attribute "Delete Rule" when use Data Type "User Identifier" 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.