Unexpected token: NEXTVAL in statement

302 views
Skip to first unread message

Jason Syf

unread,
Mar 28, 2011, 1:22:31 PM3/28/11
to play-framework
Hi all

I'm testing out a new app which connects to a PostgreSQL data source
(v9).

When trying to save my model I receive the following exception:


play.exceptions.JavaExecutionException:
org.hibernate.exception.SQLGrammarException: could not get next
sequence value
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:290)
at Invocation.HTTP Request(Play!)
...
Caused by: java.sql.SQLException: Unexpected token: NEXTVAL in
statement [select nextval ('hibernate_sequence')]
...

When I run that SQL statement manually, I do get the sequence value
(note that I created the sequence manually).

From application.conf:

db.url=jdbc:postgresql://localhost:5433/postgres
db.driver=org.postgresql.Driver
db.user=xxx
db.pass=xxx

db.pool.timeout=1000
db.pool.maxSize=30
db.pool.minSize=10

jpa.dialect=org.hibernate.dialect.PostgreSQLDialect
jpa.ddl=update
jpa.debugSQL=true

If anyone can point me in the right direction I'd be grateful!

Regards
Jason

Jason Syf

unread,
Mar 28, 2011, 1:28:57 PM3/28/11
to play-framework
I should have posted more details of the exception:

Caused by: java.sql.SQLException: Unexpected token: NEXTVAL in
statement [select nextval ('hibernate_sequence')]
at org.hsqldb.jdbc.Util.throwError(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
at
org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:
534)
at
org.hibernate.jdbc.AbstractBatcher.prepareSelectStatement(AbstractBatcher.java:
145)
at
org.hibernate.id.SequenceGenerator.generateHolder(SequenceGenerator.java:
110)
... 17 more

It seems that HSQL is being used? Why would this happen?

Thanks
Jason

Jason Syf

unread,
Mar 28, 2011, 1:36:18 PM3/28/11
to play-framework
Ah, I was running play test instead of play run. Sorry!
Reply all
Reply to author
Forward
0 new messages