Two attributes in an entity are associated with another entity

Hi,
I have an entity-testdef which has two attributes are associated with another entity UDC. The instance name of UDC is a UUID. One attribute of testdef is testtype and another attribute is udctype. The database table testdef generated by studio has two UUID field. These two UUID fields is not readable. I hope it can be a normal string field which can save the value comes from UDC. How can I do it? Thank you.
Refer%20UDC%20entity

Do you need to display values from attributes of the related UDC entity? Then in visual components bound to testdef entity you can use paths to the attributes like testtype.someUDCattr1, udctype.someUDCattr2. Keep in mind though that if these fields are editable, the changes will not be saved automatically. Alternatively, you can define a nested datasource with the related entity and bind UI components to it, then you will be able to save changes if needed.

Hi,
I added varchar(10) not null to column definition and added a view which include the fields of UDC. The fields of the entity testdef association fields in database is varchar(10). But I got an error that the value is too long to insert into database. I found CUBA generated SQL insert UUID into the associate fields which is varchar field. How can I handle this?

The error is:

Call: INSERT INTO TESTDEF (ID, CREATE_TS, CREATED_BY, DELETE_TS, DELETED_BY, UPDATE_TS, UPDATED_BY, VERSION, TESTTYPE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
bind => [5E87B7DB-9804-4860-7236-230E632CD3F8, 2018-08-22 16:55:57.688, admin, null, null, 2018-08-22 16:55:57.688, null, 1, 12D63636-D36A-5869-B911-FAF2AD271D06]
Query: InsertObjectQuery(com.company.mastert.entity.TESTDEF-5e87b7db-9804-4860-7236-230e632cd3f8 [new,managed])

Your TESTTYPE column is mapped to testtype attribute which is a reference to another entity. Reference columns contain identifiers of referenced entities, that’s why it stores UUID. Keep the column definition default, Studio generates correct DDL depending on the ID type and your database type.