Changelog Generation Error - column type is undefined

Hmmm. I took a look and I can’t find any errors in the filemaint-addon. As shown before, this is Jobdefs:

@JmixEntity
@Table(name = "JOBDEFS")
@Entity(name = "filemaint_Jobdefs")
public class Jobdefs {
    private static final long serialVersionUID = 2913012589319426949L;

    @EmbeddedId
    protected JobdefsCompKey id;

    @MapsId("cus")
    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "CUS_ID", referencedColumnName = "ID")
    protected Customers customer;

CUS_ID in Jobdefs is mapped to ID in Customers (not CUS_ID).

JobdefsCompKey is this:

@JmixEntity(name = "filemaint_JobdefsCompKey")
@Embeddable
public class JobdefsCompKey implements Serializable {
    private static final long serialVersionUID = -8702137759981849222L;

    @Column(name = "CUS_ID")
    protected Long cus;
    @Column(name = "JOB_ID")
    protected Long job;

The column names are CUS_ID and JOB_ID. I do not have them mapped here, so they don’t reference Customers.

In the customer entity, I have this:

    @OneToOne(fetch = FetchType.LAZY, mappedBy = "customer", cascade = CascadeType.ALL)
    protected Jobdefs jobdefs;

Where is it getting CUSTOMERS.CUS_ID from? I don’t know how to fix it. Any ideas?

The main point is that you can’t have two independent entities with the same table name. In such case Studio has unpredictable behavior. So we see it with changelog generation error you encountered. And I suppose that JPA would also fail to work in runtime with such entities.

Liquibase changelog generation process compares current data model state with database schema. So called “snapshot” is constructed from project entities by Jmix Studio and another “snapshot” created by Liquibase tool, then Liquibase compares this two snapshots and returns diff changelog.
When you have two Customers entities pointing to the same table (and as I see it is not only Customers, but several others) Studio can’t properly create this snapshot and we get this senseless errors.

To make Studio changelog generation process work you need to get rid of this entity duplication somehow.

If you have questions regarding project structure I think the best option is to create a new topic with detailed description of your case.

Regards, Alexander

Hi:

So, after some searching on the Forum, I think I found the appropriate solution to this problem. I need to extract all of my entities to a “model” add-on. You have an example here: Mixed Composite Project

If I do this, then the entities and tables should not be duplicated between my file maintenance add-on and my main applications. This, in turn, should remove the liquibase confusion.