I have extended a number Entities from entity “StandardGlobalEntity” in order to manage some default values across entities. The StandardGlobalEntity looks like below:
@JmixEntity
//@Table(name = “ERP_STANDARD_GLOBAL_ENTITY”)
@Entity(name = “erp_StandardGlobalEntity”)
public class StandardGlobalEntity {
@JmixGeneratedValue
@Column(name = “ID”, nullable = false)
@Id
private UUID id;@Column(name = "VERSION", nullable = false) @Version private Integer version; @CreatedBy @Column(name = "CREATED_BY") private String createdBy; @CreatedDate @Column(name = "CREATED_DATE") @Temporal(TemporalType.TIMESTAMP) private Date createdDate; @LastModifiedBy @Column(name = "LAST_MODIFIED_BY") private String lastModifiedBy; @LastModifiedDate @Column(name = "LAST_MODIFIED_DATE") @Temporal(TemporalType.TIMESTAMP) private Date lastModifiedDate; public Date getLastModifiedDate() { return lastModifiedDate; } public void setLastModifiedDate(Date lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; } public String getLastModifiedBy() { return lastModifiedBy; } public void setLastModifiedBy(String lastModifiedBy) { this.lastModifiedBy = lastModifiedBy; } public Date getCreatedDate() { return createdDate; } public void setCreatedDate(Date createdDate) { this.createdDate = createdDate; } public String getCreatedBy() { return createdBy; } public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } public Integer getVersion() { return version; } public void setVersion(Integer version) { this.version = version; } public UUID getId() { return id; } public void setId(UUID id) { this.id = id; }
}
And after I have generated the database changelog, I see all the columns of all the entities to which I extended StandardGlobalEntity extended are inherited into the entity “StandardGlobalEntity”. Since I have a large number of Entities, give the exception that the max number of columns can be 1024.
<changeSet id="1" author="erp">
<createTable tableName="erp_StandardGlobalEntity">
<column name="ID" type="UUID">
<constraints nullable="false" primaryKey="true" primaryKeyName="PK_ERP_STANDARDGLOBALENTITY"/>
</column>
<column name="DTYPE" type="VARCHAR(31)"/>
<column name="VERSION" type="INT">
<constraints nullable="false"/>
</column>
<column name="CREATED_BY" type="VARCHAR(255)"/>
<column name="CREATED_DATE" type="DATETIME"/>
<column name="LAST_MODIFIED_BY" type="VARCHAR(255)"/>
<column name="LAST_MODIFIED_DATE" type="DATETIME"/>
<column name="NAME" type="VARCHAR(255)"/>
<column name="BUSINESS_INDUSTRY_PRODUCT_TYPE" type="VARCHAR(255)"/>
<column name="BATCH_MANAGEMENT_ACTIVE" type="BOOLEAN"/>
<column name="BUSINESS_INDUSTRY_AREA" type="INT"/>
<column name="SALES_ORDER_REFERENCE_IN_PURCHASE_ORDER" type="BOOLEAN"/>
<column name="PURCHASE_ORDER_REFERENCE_IN_SALES_ORDER" type="BOOLEAN"/>
<column name="SAMPLE_APPROVAL_REQUIRED_FOR_SALES_ORDER" type="BOOLEAN"/>
<column name="PRODUCT_PRICE_MANAGEMENT" type="INT"/>
<column name="COUNTRY_ID" type="UUID"/>
<column name="COUNTRY_CODE" type="VARCHAR(4)"/>
<column name="CONTINENT_ID" type="UUID"/>
<column name="CURRENCY_ID" type="UUID"/>
<column name="CURRENCY_CODE" type="VARCHAR(4)"/>
</createTable>
</changeSet>
When I extended, I didn’t use “replace” annotations, therefore it’s not an expected behaviour.
I have done the same in a new project created in Jmix (FLOW) and when I extend an Entity to another even without using a “replace” annotation, it happens. Is this a bug?