Next reported error haven’t been solved yet and customers who develop new Cuba application modules that live together with legacy applications have to modify ever all the database scripts of constraint creation over database views:
Are you using the latest version 11.3-183 of the CUBA plugin?
An entity that is a DB view has DesignSupport anotation with parameters - “{‘dbView’:true,‘imported’:true,‘generateDdl’:false}”? Or in Entity Designer select DB View checkbox
Yes, I’m using the latest version 11.3-183 of the Cuba plugin.
I was thinking why this functionality it doesn’t work properly and there is a peculiarity that could be the key an I would explain.
There is a Cuba Studio project that only contains all the entities that are DB view of the master tables of the legacy application, with the right configuration that you mentioned:
package com.company.mestrelegacy.entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import com.haulmont.cuba.core.global.DesignSupport;
import javax.persistence.Column;
import com.haulmont.cuba.core.entity.BaseIntegerIdEntity;
import com.haulmont.chile.core.annotations.NamePattern;
@NamePattern("%s|diDes")
@DesignSupport("{'dbView':true,'imported':true,'generateDdl':false}")
@Table(name = "Divisa")
@Entity(name = "mestrelegacy$Divisa")
public class Divisa extends BaseIntegerIdEntity {
Then, there are antother Cuba Projects for different application modules that use the entities mapped to the DB View as an Application module.
When Cuba Studio generates the database scripts to generate foreign keys over database views happens in projects with entites defined in the data model of this project which have foreign keys relation to entites that belong to the Application module.
The problem is that the ‘DesignSupport’ annotation has ‘RetentionPolicy.SOURCE’ retention and is not present in compiled classes.
I will change the retention for the annotation, and also change the search engine in the Studio.
With release 12, now Studio doesn’t create the DB scripts for adding constraints to DB view entities that belongs an Application module although it still creating this kind of script for DB view entities that are defined on the same project.