Reverse Engineering - Failed to create entity: 'mytable'

Good day.
JMix studio 2.3.1
Java 21
SQL Server 16. With 280+ tables, many use foreign keys.
Brand new project …
Created data store for SQL Server, test ok
delete and proceed with Liquibse changes.
(In fact, I have successfully reversed several tables already)
But all of a sudden, I’m no longer able to …

Searched for and selected the table.
And now the love affair is over
I get the following

Failed to create entity: ‘mytable’
com.intellij.openapi.project.IndexNotReadyException:
Please change caller according to
com.intellij.openapi.project.IndexNotReadyException documentation
See log file for details (C:\Users<user>\AppData\Local\JetBrains\IdeaIC2024.1\log\idea.log)

Build it a 2nd time and I get a slightly different error:
Caused by: jakarta.persistence.PersistenceException:
Exception [EclipseLink-28018] (Eclipse Persistence Services - 4.0.2-3-jmix.v202404051618): org.eclipse.persistence.exceptions.EntityManagerSetupException

Out of the 280+ tables, about 70 are actually used. The existing app is old as the hills. The database was originally in FoxPro, remember those days?

To help you out, if I get an error, I create a brand new project and start over completely fresh. Now, I’m going to let liquibase do it’s thing and modify the schema. I have saved the schema as text and will do a difference to see what changes happen.

But, in production, we have to have absolute minimal schema changes.

If I can solve this issue in Reverse Engineering, I can get this job and it’s worth a lot to me. Thanks!

I was wondering. Once in once idea project I get an error, I get the error in any number of projects I creater after. Humm. What is common in all the projects? The database. Sure enough, I thought I had not done the database updates. But I did.

And Liquibase blows up. And it appears to be happening over the ‘Users’, not a part of my original SQL Server. So now, I got to drop this database and restore a 50GB database. Sigh.

How can I make it so Liquibase doesn’t mess me up as I’m figuring out JMix?

There are like maybe 10 to 20 companies that use this program, so whatever I do, it has to be 100% repoducable. Again, thanks.

Hi

Sorry, but it seems that you mixing two different features of Jmix Studio.

Liquibase is responsible for managing database schema and making it corresponding to the data model.
If you have legacy existing database, I guess changing its schema by Jmix application is not what you want.

To prevent such case it is recommended to have additional data store for this database with Disabled DB Schema Management. Because if database connected as a main data store, then Jmix system tables and the project ones should (and will) be created there (e.g. Users table mentioned above). Liquibase changelogs that exists in new project template and Jmix dependencies being executed on the application start by default, so you don’t even need to update database explicitly to make changes in your database schema.

Another feature is “Generate Model from Database” action. This tries its best to generate Jmix entities from existing database. When you run it for additional data store with disabled schema management, you get entities for this data store. And no Liquibase updates will be generated for them, until data store and entities set to updatable mode.

Regarding the errors:
com.intellij.openapi.project.IndexNotReadyException during entity creation is rare sporadic Jmix Studio issue as we know. We are working on it. Usually IDEA restart or caches invalidation helps.
But the second one (jakarta.persistence.PersistenceException) is seems to be a runtime issue, not Studio. Could you please provide more details on it?