Table doesn't exist on stax
Reported by Alex | October 18th, 2010 @ 06:12 PM
Framework version: 1.1RC2
Platform you're using: stax.net
Reproduction steps:
Release a simple play application to stax.net and trigger code that
persists data in the database.
Details:
I created a simple User object which extends the Play Model class.
In the index method of the controller I have the following:
renderJSON(User.findAll());
This causes the following error log on stax.net (because it cannot create the table):
7:35:03,889 WARN ~ SQL Error: 1146, SQLState: 42S02
17:35:03,889 ERROR ~ Table 'meep.user' doesn't exist
17:35:03,988 ERROR ~
@647eak70n Internal Server Error (500)
Execution exception (In /app/controllers/Users.java around line
10)
PersistenceException occured :
org.hibernate.exception.SQLGrammarException: could not execute
query
play.exceptions.JavaExecutionException:
org.hibernate.exception.SQLGrammarException: could not execute
query
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:285)
at play.server.ServletWrapper$ServletInvocation.execute(ServletWrapper.java:472)
at play.Invoker$Invocation.run(Invoker.java:187)
at play.server.ServletWrapper$ServletInvocation.run(ServletWrapper.java:463)
at play.Invoker.invokeInThread(Invoker.java:61)
at play.server.ServletWrapper.service(ServletWrapper.java:113)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at net.stax.appserver.webapp.RequestMonitorValve.invoke(RequestMonitorValve.java:35)
at net.stax.appserver.admin.StaxApplicationQueryValve.invoke(StaxApplicationQueryValve.java:42)
at net.stax.appserver.webapp.RequestSetupValve.invoke(RequestSetupValve.java:31)
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:632)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:619)
Caused by: javax.persistence.PersistenceException:
org.hibernate.exception.SQLGrammarException: could not execute
query
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1235)
at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1168)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:250)
at play.db.jpa.JPQL.findAll(JPQL.java:30)
at models.User.findAll(User.java)
at controllers.Users.index(Users.java:10)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:408)
at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:403)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:176)
... 22 more
Caused by: 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:2452)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2192)
at org.hibernate.loader.Loader.list(Loader.java:2187)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1258)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:241)
... 28 more
Caused by:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table
'meep.user' doesn't exist
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1885)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1869)
at org.hibernate.loader.Loader.doQuery(Loader.java:718)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
at org.hibernate.loader.Loader.doList(Loader.java:2449)
... 36 more
Trying to add data using a create method fails also. I have the following in my application.conf :
%stax.application.mode=prod %stax.db=jdbc/meep %stax.db.url=jdbc:stax://meep %stax.db.driver=com.staxnet.jdbc.Driver %stax.db.user=myname %stax.db.pass=mypass %stax.jpa.dialect=org.hibernate.dialect.MySQLDialect
It would be great if someone could look into this as it's really starting to get tedious..
Comments and changes to this ticket
-

Guillaume Bort November 12th, 2010 @ 08:38 AM
- State changed from new to invalid
In play 1.1 you must set explicitly 'jpa.ddl=update' in PROD mode, as stated in the release notes: http://www.playframework.org/documentation/1.1/releasenotes-1.1
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
Play framework
Play makes it easier to build Web applications with Java. It is a clean alternative to bloated Enterprise Java stacks. It focuses on developer productivity and targets RESTful architectures. Learn more on the http://www.playframework.org website.
Source code is hosted on github
Check out our repository at http://github.com/playframework/playContributing, creating a patch
Please read the contributor guideReporting Security Vulnerabilities
Since all bug reports are public, please report any security vulnerability directly to guillaume dot bort at gmail dot com.Creating a bug report
Bug reports are incredibly helpful, so take time to report bugs and request features in our ticket tracker. We’re always grateful for patches to Play’s code. Indeed, bug reports with attached patches will get fixed far quickly than those without any.Please include as much relevant information as possible including the exact framework version you're using and a code snippet that reproduces the problem.
Don't have too much expectations. Unless the bug is really a serious "everything is broken" thing, you're creating a ticket to start a discussion. Having a patch (or a branch on Github we can pull from) is better, but then again we'll only pull high quality branches that make sense to be in the core of Play.