Quarkus: Update to 0.20.0: StatementParserException line 1:590: expecting STMT_END, found 'null'

Created on 5 Aug 2019  ยท  5Comments  ยท  Source: quarkusio/quarkus

I am trying to update the quarkus-todo-app to 0.20.0.

When I run

mvn compile quarkus:dev

I get following stack trace:

[INFO] --- quarkus-maven-plugin:0.20.0:dev (default-cli) @ todo-backend ---
Listening for transport dt_socket at address: 5005
2019-08-05 06:54:46,901 INFO  [io.qua.dep.QuarkusAugmentor] (main) Beginning quarkus augmentation
    โƒ   2019-08-05 06:54:47,847 INFO  [io.qua.dep.QuarkusAugmenor] (main) Quarkus augmentation completed in 946ms
Hibernate: 

    drop table if exists Todo cascade
Hibernate: 

    drop sequence if exists hibernate_sequence
Hibernate: create sequence hibernate_sequence start 1 increment 1
Hibernate: 

    create table Todo (
       id int8 not null,
        completed boolean not null,
        ordering int4,
        title varchar(255),
        url varchar(255),
        primary key (id)
    )
Hibernate: 

    alter table if exists Todo 
       add constraint UK_oxfuur9jdyqshux5rm7g7ga6c unique (title)
javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory
    at io.quarkus.hibernate.orm.runtime.boot.FastBootEntityManagerFactoryBuilder.persistenceException(FastBootEntityManagerFactoryBuilder.java:113)
    at io.quarkus.hibernate.orm.runtime.boot.FastBootEntityManagerFactoryBuilder.build(FastBootEntityManagerFactoryBuilder.java:67)
    at io.quarkus.hibernate.orm.runtime.FastBootHibernatePersistenceProvider.createEntityManagerFactory(FastBootHibernatePersistenceProvider.java:54)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
    at io.quarkus.hibernate.orm.runtime.JPAConfig$LazyPersistenceUnit.get(JPAConfig.java:109)
    at io.quarkus.hibernate.orm.runtime.JPAConfig.startAll(JPAConfig.java:57)
    at io.quarkus.hibernate.orm.runtime.HibernateOrmRecorder.startAllPersistenceUnits(HibernateOrmRecorder.java:77)
    at io.quarkus.deployment.steps.HibernateOrmProcessor$startPersistenceUnits19.deploy_0(HibernateOrmProcessor$startPersistenceUnits19.zig:51)
    at io.quarkus.deployment.steps.HibernateOrmProcessor$startPersistenceUnits19.deploy(HibernateOrmProcessor$startPersistenceUnits19.zig:70)
    at io.quarkus.runner.ApplicationImpl1.doStart(ApplicationImpl1.zig:90)
    at io.quarkus.runtime.Application.start(Application.java:84)
    at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:127)
    at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:171)
    at io.quarkus.dev.DevModeMain.main(DevModeMain.java:89)
Caused by: org.hibernate.tool.hbm2ddl.ImportScriptException: Error during import script parsing.
    at org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor.extractCommands(MultipleLinesSqlCommandExtractor.java:31)
    at org.hibernate.tool.schema.internal.exec.AbstractScriptSourceInput.read(AbstractScriptSourceInput.java:40)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applyImportSources(SchemaCreatorImpl.java:491)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:180)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:135)
    at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:121)
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:156)
    at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:73)
    at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:315)
    at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:462)
    at io.quarkus.hibernate.orm.runtime.boot.FastBootEntityManagerFactoryBuilder.build(FastBootEntityManagerFactoryBuilder.java:65)
    ... 13 more
Caused by: org.hibernate.hql.internal.antlr.SqlStatementParser$StatementParserException: line 1:590: expecting STMT_END, found 'null'
    at org.hibernate.hql.internal.antlr.SqlStatementParser.throwExceptionIfErrorOccurred(SqlStatementParser.java:53)
    at org.hibernate.tool.hbm2ddl.MultipleLinesSqlCommandExtractor.extractCommands(MultipleLinesSqlCommandExtractor.java:28)
    ... 23 more

I have the feeling the sql statement in question is generated.

Can you give me some pointers about how to debug this kind of errors?

kinquestion

All 5 comments

Hey @jmini what does your import.sql or an equivalent sql load script look like? can you share a little producer?

Thank you a lot for this quick feedback !!!


See https://github.com/cescoffier/quarkus-todo-app/blob/master/src/main/resources/import.sql


The quarkus-todo-app example is small enough to be the reproducer.

  • Change the version in the POM to 0.20.0
  • Run ./start-database.sh to start the db
  • Run mvn compile quarkus:dev to start the app.

You are correct, the script in question was wrong.
It now works when I add ; at the end of each line.

Do you know if this is the intended behavior with 0.20.0? or if this is a regression in comparison to 0.19.1?

It's intended. We manage multi line script. So we must have ; to split statement now.
https://github.com/quarkusio/quarkus/pull/3134

Thank you a lot for this quick feedback !!!

See https://github.com/cescoffier/quarkus-todo-app/blob/master/src/main/resources/import.sql

The quarkus-todo-app example is small enough to be the reproducer.

  • Change the version in the POM to 0.20.0
  • Run ./start-database.sh to start the db
  • Run mvn compile quarkus:dev to start the app.

You are correct, the script in question was wrong.
It now works when I add ; at the end of each line.

Do you know if this is the intended behavior with 0.20.0? or if this is a regression in comparison to 0.19.1?

Indeed it is expected @Dufgui is right. SQL statement must end with ;.
Can we consider this closed? @jmini

This is also documented in the release-notes (I have missed it during my review last week):
https://quarkus.io/blog/quarkus-0-20-0-released/#hibernate-orm-multi-line-support-in-import-scripts

Thank you a lot for you quick help.

Was this page helpful?
0 / 5 - 0 ratings