The state field path 'this.deleteTs' cannot be resolved to a valid type.

I think it’s bug.

“createTs”, “createdBy”, “updateTs”, “updatedBy”, “deleteTs”, “deletedBy”, and "version"
fields name are hard coded in some JPQL code in the Cuba core module.

POC / Tested on Cuba v6.6


    @Column(name = "DATE_SUPPRESSION")
    protected Date dateSuppression;

   ....


    @Override
    public Boolean isDeleted() {
        return dateSuppression != null;
    }

    @Override
    public Date getDeleteTs() {
        return dateSuppression;
    }

    @Override
    public void setDeleteTs(Date deleteTs) {
        this.dateSuppression = deleteTs;
    }

SQL script generation of index for DELETE_TS should use the column name defined in @ @Column (not tests for others fields).

Regards,

Hi,
It is not a bug, since JPQL relies only on fields mapping. You cannot override column mappings for classes that inherit StandardEntity. You can change it only if you extend BaseGenericIdEntity and implement SoftDelete interface manually.

The same is for Versioned, Updatable, etc.

Hi,
Thanks for answer. i did not use StandardEntity (I have created my own MappedSuperclass BaseEntity )

@MappedSuperclass
public class BaseEntity extends BaseIdentityIdEntity implements Creatable, Updatable, SoftDelete {
    private static final long serialVersionUID = -9065974365759299021L;

    @Column(name = "DATE_CREATION")
    protected Date dateCreation;

    @Column(name = "CREATEUR", length = 50)
    protected String createur;

    @Column(name = "DATE_MODIFICATION")
    protected Date dateModification;

    @Column(name = "MODIFICATEUR", length = 50)
    protected String modificateur;

    @Column(name = "DATE_SUPPRESSION")
    protected Date dateSuppression;

    @Column(name = "SUPPRESSEUR", length = 50)
    protected String suppresseur;

    @Override
    public Date getCreateTs() {
        return dateCreation;
    }

    @Override
    public void setCreateTs(Date createTs) {
        this.dateCreation = createTs;
    }

    @Override
    public String getCreatedBy() {
        return createur;
    }

    @Override
    public void setCreatedBy(String createdBy) {
        this.createur = createdBy;
    }

    @Override
    public Date getUpdateTs() {
        return dateModification;
    }

    @Override
    public void setUpdateTs(Date updateTs) {
        this.dateModification = updateTs;
    }

    @Override
    public String getUpdatedBy() {
        return modificateur;
    }

    @Override
    public void setUpdatedBy(String updatedBy) {
        this.modificateur = updatedBy;
    }

    @Override
    public Boolean isDeleted() {
        return dateSuppression!= null;
    }

    @Override
    public Date getDeleteTs() {
        return dateSuppression;
    }

    @Override
    public void setDeleteTs(Date deleteTs) {
        this.dateSuppression= deleteTs;
    }

    @Override
    public String getDeletedBy() {
        return suppresseur;
    }

    @Override
    public void setDeletedBy(String deletedBy) {
        this.suppresseur= deletedBy;
    }
}

I think the issue is when name used in delete date property is other than deleteTs (for example i used dateSuppression).
In this case, an JPA error when start the App (The state field path ‘this.deleteTs’ cannot be resolved to a valid type).
Another issue, when the column name is not DELETE_TS (for example i used DATE_SUPPRESSION)
In this case, generated sql query for index

create unique index IDX_XXXXXX on XXXX (YYYY) where DELETE_TS is null ; 

sql generated with column name DELETE_TS, but should DATE_SUPPRESSION instead.
Some code use deleteTs

EntityRestore.java  .... metaClass.getProperty("deleteTs"); 
EntityLog.java  .......dirty.contains("deleteTs")

Thank you for reporting that.

It is not so big problem, we will try to fix it in the future. See issue here https://youtrack.cuba-plaltform.com/issue/PL-9511

If it is a crucial issue for you please describe your use case and we will try to find a workaround.