Cannot map to SQL when following QuickStart Guide

I followed almost exactly to the quickstart guide : CUBA Platform. Developer’s Manual. The only difference I made was just naming my entity (from English to Malay). With that said, I am unable to Generate DB Scripts because the DDL Preview isn’t generated properly.

image

And the DDL Preview of it is:

create table PERJUALAN_PEMBAYAR (
    primary key (ID)
)

Also, I don’t know if this is relevant but both of my entities shows an incompatible return type error that I don’t understand.
incompatible_return_type

Logs says:

2019-03-11 13:35:54,028 [5670814]   WARN - ndling.DefaultExceptionHandler - Studio error:
java.lang.RuntimeException: Cannot map to SQL type: com.company.perjualan.entity.Pembayar of com.company.perjualan.entity.Order#customer
        at com.haulmont.studio.backend.ed.ddl.HsqlDdlGenerator.getMappedType(SourceFile:174)
        at com.haulmont.studio.backend.ed.ddl.AbstractDdlGenerator.generateColumn(SourceFile:1196)
        at com.haulmont.studio.backend.ed.ddl.AbstractDdlGenerator.getColumnDefinition(SourceFile:942)
        at com.haulmont.studio.backend.ed.ddl.TableGenerator.processRestPersistentAttributes(SourceFile:143)
        at com.haulmont.studio.backend.ed.ddl.TableGenerator.processing(SourceFile:79)
        at com.haulmont.studio.backend.ed.ddl.AbstractDdlGenerator.generateTable(SourceFile:305)
        at com.haulmont.studio.backend.ed.ddl.AbstractDdlGenerator.generateInitDdl(SourceFile:145)
        at com.haulmont.studio.backend.ed.ddl.TableUpdatesGenerator.processing(SourceFile:112)
        at com.haulmont.studio.backend.ed.ddl.AbstractDdlGenerator.generateTableUpdates(SourceFile:492)
        at com.haulmont.studio.backend.ed.ddl.AbstractDdlGenerator.generateUpdates(SourceFile:481)
        at com.intellij.openapi.progress.impl.CoreProgressManager$1.run(CoreProgressManager.java:220)
        at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:727)
        at com.intellij.openapi.progress.impl.CoreProgressManager$5.run(CoreProgressManager.java:442)
        at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:164)
        at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:582)
        at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
        at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:87)
        at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:151)
        at com.intellij.openapi.application.impl.ApplicationImpl.lambda$null$10(ApplicationImpl.java:592)
        at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

Managed to fix this by uninstalling and reinstalling Cuba Studio Platform. Not the best way to understand why this happened. But moving forward, the application wasn’t working and that there was a problem to my database, even though test connection says its successful. Noticed that the generated password was too encryptic that Java won’t like the ampersand symbol “&” and just changed it to simple alphanumeric and that solved the database problem.

Also, its to be informed that Create Database needs to be successful first before attempting to DDL Preview or Generate DB Scripts.

Hi,
Thanks for your feedback!

The first issue seems to be caused by broken dependencies to JDK classes. You can see that IDE can’t resolve java.lang.String class. We have faced the issue several times, but can’t find reliable way to reproduce. Looks like some Intellij IDEA bug. To fix the issue you can go to Project Structure (Ctrl + Alt + Shift + S), select SDKs tab, remove the current JDK of the project and add it again.

The second issue with ampersand will be fixed in one of the next releases (see YouTrack issue)

You don’t need to create database before generating DB scripts. The only requirement is availability of database server. In case you don’t want to setup connection, you can always switch back to HSQL in memory database.

1 Like