Ошибка SilentException при генерации скриптов liquibase из jmix studio

Добрый день,

В нашем проекте используется базовый класс сущностей StandardEntity (аналогичный классу cuba), написанный на kotlin:

@JmixEntity(name = "its_StandardEntity")
@MappedSuperclass
abstract class StandardEntity {

    @Id
    @JmixGeneratedValue
    @Column(name = "ID", nullable = false)
    var id: UUID? = null

...

}

После переноса этого класса в add-on при генерации скриптов через jmix studio возникает ошибка “SilentException: Entity TestEntity has no attribute applicable for table id column” и генерация завершается.

Stacktrace (из idea.log):

liquibase.command.CommandExecutionException: com.haulmont.jmixstudio.exceptions.SilentException: Entity TestEntity has no attribute applicable for table id column

2022-02-14 14:16:46,184 [ 148779]   WARN - rateDiffChangelogActionProcess - liquibase.command.CommandExecutionException: com.haulmont.jmixstudio.exceptions.SilentException: Entity TestEntity has no attribute applicable for table id column 
liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: com.haulmont.jmixstudio.exceptions.SilentException: Entity TestEntity has no attribute applicable for table id column
	at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:211)
	at com.haulmont.jmixstudio.liquibase.LiquibaseCommandManager.generateDiffChangeLog(LiquibaseCommandManager.kt:261)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$$inlined$runReadAction$1$lambda$1$1.invoke(LiquibaseIntellijDiffGenerationHandler.kt:104)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$$inlined$runReadAction$1$lambda$1$1.invoke(LiquibaseIntellijDiffGenerationHandler.kt:31)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler.use(LiquibaseIntellijDiffGenerationHandler.kt:129)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler.access$use(LiquibaseIntellijDiffGenerationHandler.kt:31)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$$inlined$runReadAction$1$lambda$1.invoke(LiquibaseIntellijDiffGenerationHandler.kt:91)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$$inlined$runReadAction$1$lambda$1.invoke(LiquibaseIntellijDiffGenerationHandler.kt:31)
	at com.haulmont.jmixstudio.liquibase.LiquibaseCommandManagerKt.runWithPluginClassLoader(LiquibaseCommandManager.kt:460)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$doRun$$inlined$runReadAction$1.compute(actions.kt:60)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:852)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler.doRun(LiquibaseIntellijDiffGenerationHandler.kt:148)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$run$changeLogFile$1.compute(LiquibaseIntellijDiffGenerationHandler.kt:66)
	at com.haulmont.jmixstudio.liquibase.LiquibaseIntellijDiffGenerationHandler$run$changeLogFile$1.compute(LiquibaseIntellijDiffGenerationHandler.kt:31)
	at com.intellij.openapi.progress.impl.CoreProgressManager$1.run(CoreProgressManager.java:269)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:436)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:120)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressSynchronously$8(CoreProgressManager.java:542)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$new$0(ProgressRunner.java:83)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:244)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:624)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:698)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:646)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:623)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:244)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: liquibase.command.CommandExecutionException: com.haulmont.jmixstudio.exceptions.SilentException: Entity TestEntity has no attribute applicable for table id column
	at liquibase.command.AbstractCommand.execute(AbstractCommand.java:24)
	at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:209)
	... 35 more
Caused by: com.haulmont.jmixstudio.exceptions.SilentException: Entity TestEntity has no attribute applicable for table id column
	at com.haulmont.jmixstudio.model.Entity.getIdAttribute(Entity.java:314)
	at liquibase.ext.intellij.snapshot.SequenceSnapshotGenerator$SequenceGeneratorFactory.T(SequenceSnapshotGenerator.java:87)
	at liquibase.ext.intellij.snapshot.SequenceSnapshotGenerator.S(SequenceSnapshotGenerator.java:61)
	at liquibase.ext.intellij.snapshot.IntellijSnapshotGenerator.snapshot(IntellijSnapshotGenerator.java:83)
	at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:49)
	at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:315)
	at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:106)
	at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:59)
	at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:38)
	at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:215)
	at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:188)
	at liquibase.command.core.DiffCommand.createReferenceSnapshot(DiffCommand.java:222)
	at liquibase.command.core.DiffCommand.createDiffResult(DiffCommand.java:144)
	at liquibase.command.core.DiffToChangeLogCommand.run(DiffToChangeLogCommand.java:57)
	at liquibase.command.AbstractCommand.execute(AbstractCommand.java:19)
	... 36 more

До переноса класса в add-on (пока он находился в проекте) генерация работала корректно.

Видимо проблема не связана с наследованием классов сущностей, т.к. идентичная ошибка также возникает в случае, если в add-on есть сущности, реализованные на kotlin.

Тестовый проект, в котором воспроизводится проблема - jmix-petclinic.

Шаги для воспроизведения пробелмы:

  1. Открыть проект jmix-kotlin-addon и выполнить gradle publishToMavenLocal.
  2. Открыть проект jmix-petclinic.
  3. Запустить генерацию liquibase changelogs из jmix studio.

Результат:
Ошибка “SilentException: Entity com.company.jmix_kotlin_addon.entity.TestEntity has no attribute applicable for table id column”.

В качестве временного решения можно отключить SequenceSnapshotGenerator в jmix studio.

Добрый день

Спасибо, что сообщили о проблеме, действительно Студия некорректно работает с Котлин сущностями из зависимостей.
Создан тикет в YouTrack.

Добрый день,

В версии jmix studio 1.2.0-213 ошибка SilentException не возникает, исходная проблема исправлена, спасибо!

Однако в случае с наследованием от сущности из add-on генерируется некорректные скрипты liquibase для свойств StandardEntity, используются имена свойств вместо названия колонок (например, “createTs” вместо “CREATE_TS”).

Пример сгенерированного скрипта:

<createTable tableName="PETCLINIC_JST2633_ENTITY">
    <column name="id"
            type="UUID">
        <constraints nullable="false"
                     primaryKey="true"
                     primaryKeyName="PK_PETCLINIC_JST2633_ENTITY"/>
    </column>
    <column name="version"
            type="INT"/>
    <column name="createTs"
            type="DATETIME"/>
    <column name="updateTs"
            type="DATETIME"/>
</createTable>

Проблема воспроизводится в тестовом проекте jmix-petclinic для сущности Jst2633Entity.

Добрый день!

Склонировал приложенный проект и аддон с репозитория. Сгенерированные liquibase имена столбцов действительно не соответствуют указанным в StandartEntity. Спасибо за информацию, создан тикет в youtrack

1 симпатия