Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

  1. ,
    Expert tip

    Check if you're not creating unused SQL entities, as it might cause this exception.

org.hibernate.exception.SQLGrammarException: could not prepare statement at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:123) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:193) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:157) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1881) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1858) at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1838) at org.hibernate.loader.Loader.doQuery(Loader.java:906) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:348) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:318) at org.hibernate.loader.Loader.loadCollectionSubselect(Loader.java:2329) at org.hibernate.loader.collection.SubselectOneToManyLoader.initialize(SubselectOneToManyLoader.java:79) at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:674) at org.hibernate.event.internal.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:86) at org.hibernate.internal.SessionImpl.initializeCollection(SessionImpl.java:1810) at org.hibernate.collection.internal.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:696) at org.hibernate.Hibernate.initialize(Hibernate.java:77) at com.blazebit.persistence.testsuite.Issue227Test.testFetchModeSubselectOnCteQueryResult(Issue227Test.java:86) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.junit.runner.JUnitCore.run(JUnitCore.java:160) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)Caused by: org.h2.jdbc.JdbcSQLException: Table "ISSUE227TEST$RECURSIVEENTITYCTE" not found; SQL statement:select children0_.parent_id as parent_i3_1_1_, children0_.id as id1_1_1_, children0_.id as id1_1_0_, children0_.name as name2_1_0_, children0_.parent_id as parent_i3_1_0_ from issue_227_recursive_entity children0_ where children0_.parent_id in (select issue227te1_.id from issue_227_recursive_entity issue227te0_ where issue227te0_.parent_id is not nullUNION ALLselect issue227te0_.id as col_0_0_, issue227te0_.name as col_1_0_, issue227te0_.parent_id as col_2_0_ from issue_227_recursive_entity issue227te0_ cross join Issue227Test$RecursiveEntityCte issue227te1_ where issue227te0_.id=issue227te1_.parent_id)select issue227te0_.id as id1_0_0_, issue227te1_.id as id1_1_1_, issue227te0_.name as name2_0_0_, issue227te0_.parent_id as parent_i3_0_0_, issue227te1_.name as name2_1_1_, issue227te1_.parent_id as parent_i3_1_1_ from Issue227Test$RecursiveEntityCte issue227te0_ left outer join issue_227_recursive_entity issue227te1_ on issue227te0_.parent_id=issue227te1_.id) [42102-183] at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) at org.h2.message.DbException.get(DbException.java:179) at org.h2.message.DbException.get(DbException.java:155) at org.h2.command.Parser.readTableOrView(Parser.java:5239) at org.h2.command.Parser.readTableFilter(Parser.java:1227) at org.h2.command.Parser.readJoin(Parser.java:1548) at org.h2.command.Parser.parseJoinTableFilter(Parser.java:1872) at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:1867) at org.h2.command.Parser.parseSelectSimple(Parser.java:1975) at org.h2.command.Parser.parseSelectSub(Parser.java:1860) at org.h2.command.Parser.parseSelectUnionExtension(Parser.java:1696) at org.h2.command.Parser.parseSelectUnion(Parser.java:1682) at org.h2.command.Parser.parseSelect(Parser.java:1669) at org.h2.command.Parser.readCondition(Parser.java:2113) at org.h2.command.Parser.readAnd(Parser.java:2030) at org.h2.command.Parser.readExpression(Parser.java:2022) at org.h2.command.Parser.parseSelectSimple(Parser.java:1979) at org.h2.command.Parser.parseSelectSub(Parser.java:1860) at org.h2.command.Parser.parseSelectUnion(Parser.java:1681) at org.h2.command.Parser.parseSelect(Parser.java:1669) at org.h2.command.Parser.parsePrepared(Parser.java:433) at org.h2.command.Parser.parse(Parser.java:305) at org.h2.command.Parser.parse(Parser.java:277) at org.h2.command.Parser.prepareCommand(Parser.java:242) at org.h2.engine.Session.prepareLocal(Session.java:446) at org.h2.engine.Session.prepareCommand(Session.java:388) at org.h2.jdbc.JdbcConnection.prepareCommand(JdbcConnection.java:1189) at org.h2.jdbc.JdbcPreparedStatement.<init>(JdbcPreparedStatement.java:72) at org.h2.jdbc.JdbcConnection.prepareStatement(JdbcConnection.java:277) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:159) at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:183) ... 39 more