title: Create table with native SQL works for Hibernate/HSQLDB, insert fails. Why?
body: <p>I use HSQLDB and Hibernate. I have to implement some functionality on database level (trigger ...) and because of this I have to execute some native SQL. I create a new table (works) and then try to insert some data (fails). I do this as SA such there should be no access right violation. Someone can guess why the <code>user lacks privilege or object not found: A492Interface</code> is thrown?</p>
  
  <p>This is my code (simplified):</p>
  
  <pre><code>session.createSQLQuery("CREATE TABLE entity_table_map (entity_name VARCHAR(50) NOT NULL PRIMARY KEY,table_name VARCHAR(50) NOT NULL)").executeUpdate();
  session.createSQLQuery("INSERT INTO entity_table_map (entity_name,table_name) VALUES (\"A429Interface\",\"interface\")").executeUpdate();
  </code></pre>
  
  <p>Here is the relevant  log:</p>
  
  <pre><code>[Server@19616c7]: 0:SQLCLI:SQLPREPARE CREATE TABLE entity_table_map (entity_name VARCHAR(50) NOT NULL PRIMARY KEY,table_name VARCHAR(50) NOT NULL)
  [Server@19616c7]: 0:SQLCLI:SQLEXECUTE:5
  [Server@19616c7]: 0:SQLCLI:SQLFREESTMT:5
  [Server@19616c7]: 0:HSQLCLI:GETSESSIONATTR
  [Server@19616c7]: 0:SQLCLI:SQLPREPARE INSERT INTO entity_table_map (entity_name,table_name) VALUES ("A492Interface","interface")
  [Server@19616c7]: [Thread[HSQLDB Connection @13adc56,5,HSQLDB Connections @19616c7]]: 0:disconnected SA
  </code></pre>
  
  <p>And here the exception:</p>
  
  <pre><code>Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute native bulk manipulation query
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:219)
      at org.hibernate.impl.SessionImpl.executeNativeUpdate(SessionImpl.java:1310)
      at org.hibernate.impl.SQLQueryImpl.executeUpdate(SQLQueryImpl.java:396)
      at version.api.VersionAPI.setupDatabase(VersionAPI.java:38)
      at test.ui.VersionUI.setupDatabase(VersionUI.java:107)
      at test.SetupDatabase.main(SetupDatabase.java:9)
  Caused by: java.sql.SQLSyntaxErrorException: user lacks privilege or object not found: A492Interface
      at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
      at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
      at org.hsqldb.jdbc.JDBCPreparedStatement.&lt;init&gt;(Unknown Source)
      at org.hsqldb.jdbc.JDBCConnection.prepareStatement(Unknown Source)
      at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
      at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:116)
      at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)
      at org.hibernate.engine.query.NativeSQLQueryPlan.performExecuteUpdate(NativeSQLQueryPlan.java:202)
      ... 5 more
  </code></pre>
  
  <p><strong>Update:</strong> It seems I can't execute any insert statement. If I try to insert data into an other table this fails, too. I must be doing something realy dumb ... but didn't see it ...</p>