CUBA Studio always generates update scripts for a entity

Hello,

I have the problem that CUBA Studio always wants to create update scripts for an entity even if they are already created and executed. Here is the entity for which it generates the scripts:

@NamePattern("%s|field")
@Table(name = "KSM_LDAP_MAPPING")
@Entity(name = "ksm_LdapMapping")
public class LdapMapping extends StandardEntityWithoutSoftDelete {
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "LDAP_CONFIGURATION_ID")
    protected LdapConfiguration ldapConfiguration;

    @NotNull
    @Column(name = "FIELD", nullable = false)
    protected String field;

    @NotNull
    @Column(name = "LDAP_ATTRIBUTE", nullable = false)
    protected String ldapAttribute;

    @Column(name = "FILTER_FIELD")
    protected Boolean filterField;

    @NotNull
    @Column(name = "COLUMN_POSITION", nullable = false)
    protected Integer columnPosition;

    public Integer getColumnPosition() {
        return columnPosition;
    }

    public void setColumnPosition(Integer columnPosition) {
        this.columnPosition = columnPosition;
    }

    public LdapConfiguration getLdapConfiguration() {
        return ldapConfiguration;
    }

    public void setLdapConfiguration(LdapConfiguration ldapConfiguration) {
        this.ldapConfiguration = ldapConfiguration;
    }

    public Boolean getFilterField() {
        return filterField;
    }

    public void setFilterField(Boolean filterField) {
        this.filterField = filterField;
    }

    public String getLdapAttribute() {
        return ldapAttribute;
    }

    public void setLdapAttribute(String ldapAttribute) {
        this.ldapAttribute = ldapAttribute;
    }

    public LdapMappingField getField() {
        return field == null ? null : LdapMappingField.fromId(field);
    }

    public void setField(LdapMappingField field) {
        this.field = field == null ? null : field.getId();
    }
}

The FK refers to the following entity:

@NamePattern("%s|server")
@Table(name = "KSM_LDAP_CONFIGURATION")
@Entity(name = "ksm_LdapConfiguration")
public class LdapConfiguration extends StandardEntityWithoutSoftDelete {
    @NotNull
    @Column(name = "SERVER", nullable = false)
    protected String server;

    @NotNull
    @Column(name = "USER_NAME", nullable = false)
    protected String userName;

    @NotNull
    @Column(name = "PASSWORD", nullable = false)
    protected String password;

    @NotNull
    @Column(name = "ACTIVE", nullable = false)
    protected Boolean active = false;

    @NotNull
    @Column(name = "ACTIVE_DIRECTORY", nullable = false)
    protected Boolean activeDirectory = false;

    @NotNull
    @Column(name = "LDAP_BASE", nullable = false)
    protected String ldapBase;

    @Column(name = "LDAP_GROUP_BASE")
    protected String ldapGroupBase;

    @NotNull
    @Column(name = "USER_SEARCH_STRING", nullable = false)
    protected String userSearchString;

    @NotNull
    @Column(name = "GROUP_SEARCH_STRING", nullable = false)
    protected String groupSearchString;

    @NotNull
    @Column(name = "UID_ATTRIBUTE", nullable = false)
    protected String uidAttribute;

    @OneToMany(mappedBy = "ldapConfiguration")
    protected List<LdapMapping> mappings;

    @Lob
    @Column(name = "MAPPING_SCRIPT")
    protected String mappingScript;

    @NotNull
    @Column(name = "IGNORE_PARTIAL_RESULT_EXCEPTION", nullable = false)
    private Boolean ignorePartialResultException = false;

    @NotNull
    @Column(name = "IGNORE_NAME_NOT_FOUND_EXCEPTION", nullable = false)
    private Boolean ignoreNameNotFoundException = false;

    public Boolean getIgnoreNameNotFoundException() {
        return ignoreNameNotFoundException;
    }

    public void setIgnoreNameNotFoundException(Boolean ignoreNameNotFoundException) {
        this.ignoreNameNotFoundException = ignoreNameNotFoundException;
    }

    public Boolean getIgnorePartialResultException() {
        return ignorePartialResultException;
    }

    public void setIgnorePartialResultException(Boolean ignorePartialResultException) {
        this.ignorePartialResultException = ignorePartialResultException;
    }

    public String getMappingScript() {
        return mappingScript;
    }

    public void setMappingScript(String mappingScript) {
        this.mappingScript = mappingScript;
    }

    public List<LdapMapping> getMappings() {
        return mappings;
    }

    public void setMappings(List<LdapMapping> mappings) {
        this.mappings = mappings;
    }

    public String getUidAttribute() {
        return uidAttribute;
    }

    public void setUidAttribute(String uidAttribute) {
        this.uidAttribute = uidAttribute;
    }

    public Boolean getActive() {
        return active;
    }

    public void setActive(Boolean active) {
        this.active = active;
    }

    public String getGroupSearchString() {
        return groupSearchString;
    }

    public void setGroupSearchString(String groupSearchString) {
        this.groupSearchString = groupSearchString;
    }

    public String getUserSearchString() {
        return userSearchString;
    }

    public void setUserSearchString(String userSearchString) {
        this.userSearchString = userSearchString;
    }

    public Boolean getActiveDirectory() {
        return activeDirectory;
    }

    public void setActiveDirectory(Boolean activeDirectory) {
        this.activeDirectory = activeDirectory;
    }

    public String getLdapGroupBase() {
        return ldapGroupBase;
    }

    public void setLdapGroupBase(String ldapGroupBase) {
        this.ldapGroupBase = ldapGroupBase;
    }

    public String getLdapBase() {
        return ldapBase;
    }

    public void setLdapBase(String ldapBase) {
        this.ldapBase = ldapBase;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getServer() {
        return server;
    }

    public void setServer(String server) {
        this.server = server;
    }
}

Here are the scripts it always generates:

210705-1-updateLdapMapping01.sql:

alter table KSM_LDAP_MAPPING drop foreign key FK_KSM_LDAP_MAPPING_ON_LDAP_CONFIGURATION;

210705-2-updateLdapMapping02.sql:

alter table KSM_LDAP_MAPPING add constraint FK_KSM_LDAP_MAPPING_ON_LDAP_CONFIGURATION foreign key (LDAP_CONFIGURATION_ID) references KSM_LDAP_CONFIGURATION(ID);

I use CUBA Studio 15.4-202, CUBA 7.2.11 with Java 11 and MySQL 8.0.23 as database.

Many greetings
Andreas

Hi.
Could you please clarify the exact steps to reproduce? Do you have the LDAP addon in your project? If it is possible, could you share the small project in order to help us investigate the problem?

Regards,
Natalia