Ошибка IllegalStateException при генерации скриптов БД

Добрый день,

При генерации скриптов БД для сущности с наследованием возникает ошибка “java.lang.IllegalStateException: Attributes with the column name ‘***’ not unique for class …”.

Проблему можно воспроизвести в проекте sample-library-cuba7 для сущности BaseTestEntity. Ошибка в idea.log:

2020-01-30 16:42:49,439 [101675622]   WARN - ndling.DefaultExceptionHandler - Studio error: 
java.lang.IllegalStateException: Attributes with the column name 'TOWN_ID' not unique for class com.company.library.entity.test.BaseTestEntity
	at com.haulmont.studio.backend.ed.ddl.AbstractDdlGenerator.discriminatorAttribute(SourceFile:924)
	at com.haulmont.studio.backend.ed.ddl.AbstractDdlGenerator.generateDiscriminatorColumn(SourceFile:979)
	at com.haulmont.studio.backend.ed.ddl.TableGenerator.processNotPersistentParent(SourceFile:278)
	at com.haulmont.studio.backend.ed.ddl.TableGenerator.processing(SourceFile:65)
	at com.haulmont.studio.backend.ed.ddl.AbstractDdlGenerator.generateTable(SourceFile:308)
	at com.haulmont.studio.backend.ed.ddl.TableUpdatesGenerator.processNewTables(SourceFile:655)
	at com.haulmont.studio.backend.ed.ddl.TableUpdatesGenerator.processing(SourceFile:172)
	at com.haulmont.studio.backend.ed.ddl.AbstractDdlGenerator.generateTableUpdates(SourceFile:499)
	at com.haulmont.studio.backend.ed.ddl.AbstractDdlGenerator.generateUpdates(SourceFile:488)
	at com.intellij.openapi.progress.impl.CoreProgressManager$1.run(CoreProgressManager.java:219)
	at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:888)
	at com.intellij.openapi.progress.impl.CoreProgressManager$5.run(CoreProgressManager.java:441)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:163)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:585)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:531)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:150)
	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$null$4(ApplicationImpl.java:441)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:221)
	at com.intellij.util.ConcurrencyUtil.lambda$underThreadNameRunnable$3(ConcurrencyUtil.java:209)
	at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:238)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	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.lang.Thread.run(Thread.java:834)

У сущности BaseTestEntity одна колонка БД используется для двух свойств, ManyToOne и Column:

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "TOWN_ID")
    protected Town town;

    @Column(name = "TOWN_ID", insertable = false, updatable = false)
    protected UUID townId;

Ошибка возникает только для сущностей, в которых используется наследование (аннотации Inheritance, DiscriminatorColumn). Для сущностей без наследования скрипты генерируются корректно, приложение работает без ошибок.

Версия CUBA Studio: 12.3-191. В версии Studio 6.x такой проблемы не было.

1 симпатия

Добрый день, @danila.daring.

Спасибо за сообщение об ошибке, исправим в ближайшем релизе.
https://youtrack.cuba-platform.com/issue/STUDIO-7787

Спасибо!