Error mapping data from database

Hi, I try to generate model from Sql Server database and I have a problem with the foreign key, because it not mapping into platform. What is the best practice for mapping it?

image

Thanks,

Hello, someone have Any suggestion?

Hi! Probably, you did not choose ‘EMP_CFGPERSONAL’ table on the first step ‘Select tables that you want to map to data model’. Also it is possible that ‘EMP_CFGPERSONAL’ table is in another database schema. Studio model generator can only work with one database schema. In the latter case:

  1. Create additional datastore for another database schema
  2. Generate model for additional datastore.
  3. In entity designer, create the reference to an entity from additional datastore.

See: CUBA Platform. Developer’s Manual

Hi Alexander the table ‘EMP_CFGPERSONAL’ was mapped to data model before to map this table ‘EMP_ACTENCABEZADO’

The problem really exists. We will try to fix it in the next releases. Workaround:

  1. Migrate ‘EMP_ACTENCABEZADO’ table without reference on ‘EMP_CFGPERSONAL’
  2. Open ‘EMP_ACTENCABEZADO’ entity in ‘ENTITY DESIGNER’
  3. Add attributes ‘aprobador’ and ‘moderador’ (attribute type: association, type: ‘EMP_CFGPERSONAL’, column APROBADOR_ID and MODERADOR_ID respectively)
  4. Open entity source in IDE and remove ‘unmappedColumns’ argument from ‘@DesignSupport’ annotation

Thank you so much Alexander