title: Syntax issue with HSQL sequence: `NEXTVAL` instead of `NEXT VALUE`
body: <p>I have webapps deployed on a Jetty server and connected to HSQLDB databases located on the HSQLDB server. I get this error when I try to create an entity:</p>
  
  <blockquote>
    <p>ERROR org.hibernate.util.JDBCExceptionReporter Unexpected token: NEXTVAL in statement [/* dynamic native SQL query */ SELECT nextval('campagne_sequence')] </p>
  </blockquote>
  
  <p>I initialize the sequence as follows:</p>
  
  <pre><code>CREATE SEQUENCE PUBLIC.CAMPAGNE_SEQUENCE START WITH 1 INCREMENT BY 1
  </code></pre>
  
  <p>In my webapp, I set the Hibernate dialect with <code>org.hibernate.dialect.HSQLDialect</code></p>
  
  <p>I checked the syntax to create a sequence and it's correct. I'm using hsqldb-1.8.0.10 and I also checked if the syntax have changed for the next version, it didn't.</p>
  
  <p>I know the correct syntax is <code>NEXT VALUE</code> and not <code>NEXTVAL</code> as in PostgreSQL, but I don't how to fix it. Can anyone help me with this? Thanks</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>In test-environment, everything works fine. All my tests run fine. But in dev-environment, I get the error when I try to create a <code>Campagne</code>. There is a test which creates one too and it works. So it should work with hsqldb-1.8.0.10 version.</p>
  
  <p>I tried to add the String <code>;sql.syntax_pgs=true</code> after the database URL, didn't work.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>This is the full stack trace I get:</p>
  
  <pre><code>2014-01-22 10:24:22,813 [RMI TCP Connection(6)-127.0.0.1] WARN  org.hibernate.util.JDBCExceptionReporter SQL Error: -11, SQLState: 37000
  2014-01-22 10:24:22,820 [RMI TCP Connection(6)-127.0.0.1] ERROR org.hibernate.util.JDBCExceptionReporter Unexpected token: NEXTVAL in statement [/* dynamic native SQL query */ SELECT nextval('campagne_sequence')]
  2014-01-22 10:24:22,827 [RMI TCP Connection(6)-127.0.0.1] WARN  org.springframework.remoting.support.RemoteInvocationTraceInterceptor Processing of RmiServiceExporter remote call resulted in fatal exception: com.square.core.service.interfaces.CampagneService.creerCampagne
  org.hibernate.exception.SQLGrammarException: could not execute query
      at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
      at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      at org.hibernate.loader.Loader.doList(Loader.java:2536)
      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
      at org.hibernate.loader.Loader.list(Loader.java:2271)
      at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316)
      at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1842)
      at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
      at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:157)
      at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:859)
      at com.square.core.dao.implementations.CampagneDaoImplementation.rechercherSequence(CampagneDaoImplementation.java:169)
      at com.square.core.util.sequence.CampagneSequenceUtilImpl.rechercherSequence(CampagneSequenceUtilImpl.java:32)
      at com.square.core.service.implementations.CampagneServiceImplementation.creerCampagne(CampagneServiceImplementation.java:156)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at $Proxy263.creerCampagne(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      at org.springframework.security.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:66)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at $Proxy264.creerCampagne(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
      at org.springframework.remoting.support.RemoteInvocationTraceInterceptor.invoke(RemoteInvocationTraceInterceptor.java:77)
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      at $Proxy263.creerCampagne(Unknown Source)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at org.springframework.remoting.support.RemoteInvocation.invoke(RemoteInvocation.java:205)
      at org.springframework.security.context.rmi.ContextPropagatingRemoteInvocation.invoke(ContextPropagatingRemoteInvocation.java:103)
      at org.springframework.remoting.support.DefaultRemoteInvocationExecutor.invoke(DefaultRemoteInvocationExecutor.java:38)
      at org.springframework.remoting.support.RemoteInvocationBasedExporter.invoke(RemoteInvocationBasedExporter.java:78)
      at org.springframework.remoting.rmi.RmiBasedExporter.invoke(RmiBasedExporter.java:72)
      at org.springframework.remoting.rmi.RmiInvocationWrapper.invoke(RmiInvocationWrapper.java:72)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
      at sun.rmi.transport.Transport$1.run(Transport.java:177)
      at sun.rmi.transport.Transport$1.run(Transport.java:174)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)
  Caused by: java.sql.SQLException: Unexpected token: NEXTVAL in statement [/* dynamic native SQL query */ SELECT nextval('campagne_sequence')]
      at org.hsqldb.jdbc.Util.throwError(Unknown Source)
      at org.hsqldb.jdbc.jdbcPreparedStatement.&lt;init&gt;(Unknown Source)
      at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
      at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:171)
      at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:278)
      at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:534)
      at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
      at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
      at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
      at org.hibernate.loader.Loader.doQuery(Loader.java:801)
      at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
      at org.hibernate.loader.Loader.doList(Loader.java:2533)
      ... 68 more
  </code></pre>