Error in Association Attributes

Dear All,

In my customers entity, I have a field called “Customer Group” which is linked to a code lookup generic table which contains codes/descriptions.

Although this sounds very easy and straightforward to implement, I am facing the following issue:

  1. I have set the attribute to association (as per attached snapshot). When I update database, I get the error shown in Error1 snapshot. This is because the field Customer_Group_Id is created as integer (for a reason that I dont know) and it is a foreign key linked to the ID of Codelkup table which is varchar(32). How can we set the datatype of the association field?

  2. To overcome this issue, I manually changed the type of Customer_Group_Id to varchar(32) on the physical table. In this case, I get the error shown in Error2 snapshot. Why is it trying to remove the constraint used by the foreign key? I am so confused about this behavior.

Appreciate your prompt feedback.

Shady

CustomerGroupAttribute

Error1

Error2

Hi,

  1. Which version of Studio do you use? When you added the mandatory association attribute (customerGroup), did Studio show any warning?
    I am using the 6.3.3 and it shows the following.

As written, when the table already has data, please, divide DB-update into two steps: 1. add the link field, 2. make it mandatory.

  1. What could be seen on your screenshots: the “Customer” entity is BaseIntegerIdEntity. And which ID type has “CodeLkup”? It seems it is also Integer as the link attribute has the Integer type.

Regards.

Warning

Hi,

  1. Yes I got a similar warning. But the customer table is still empty, so it was OK to ignore it.

  2. All my entities inherit BaseIntegerIdEntity, but for some reason, the primary key is ID varchar(32) in all tables. Is this normal?
    And why is it trying to remove the constraint used by the foreign key?

Thanks for your help.

Regards.

Hi,

The additional “UUID” column is created when the HasUUID interface is implemented (you can disable it).

It is used for some mechanisms in the platform, for instance, Entity log could not work if the entity has no UUID property.

The primary key of the entity is still the “ID” property. And it has the Integer type.

hasuuid

Hi,

Thanks for your feedback. The issue was that I initially created the entities based on Standard Entity, so the ID column got created in the database as varchar.
Later on, I discovered that I have to make the entities inherit BaseIntegerEntity, so I did the change from the IDE, since the option is not available in Studio dropdown once the entity is created. Doing so did not update the backend ID field back to integer, and that was the reason of the issue.
I am not sure if this is a bug or it is meant to be re-updated manually on the backend.

Thanks,