Error when creating table in oracle

320 views
Skip to first unread message

Monteiro

unread,
Jan 6, 2010, 6:09:20 AM1/6/10
to play-framework
Hello,

To configure an oracle database I've created the configurations in
application.conf:

db.url=jdbc:oracle:thin:@oraportal.com:1521:iasdb
db.driver=oracle.jdbc.driver.OracleDriver
db.user=usertest
db.pass=usertest

and configured the dialect:
jpa.dialect=org.hibernate.dialect.Oracle10gDialect


and when i play the application and do a findall, it generates the
following exceptions:

11:02:10,159 ERROR ~ Unsuccessful: create table User (id number(19,0)
not null, email varchar2(255 char), fullname varchar2(255 char), obs
varchar2(255 char), phone varchar2(255 char), primary key (id))
11:02:10,159 ERROR ~ ORA-00903: invalid table name

11:02:10,222 INFO ~ Application '' is now started !
11:02:10,506 WARN ~ SQL Error: 903, SQLState: 42000
11:02:10,506 ERROR ~ ORA-00903: invalid table name

11:02:10,621 ERROR ~

@615jodhh6
Internal Server Error (500) for request GET /

Java exception (In /app/controllers/Application.java around line 15)
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:200)
at Invocation.HTTP Request(Play!)
Caused by: javax.persistence.PersistenceException:
org.hibernate.exception.SQLGrammarException: could not execute query
at
org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException
(AbstractEntityManagerImpl.java:614)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:76)
at models.User.findAll(User.java)
at controllers.Application.index(Application.java:15)
at play.utils.Java.invokeStatic(Java.java:129)
at play.mvc.ActionInvoker.invoke(ActionInvoker.java:127)
... 1 more
Caused by: org.hibernate.exception.SQLGrammarException: could not
execute query
at org.hibernate.exception.SQLStateConverter.convert
(SQLStateConverter.java:90)
at org.hibernate.exception.JDBCExceptionHelper.convert
(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2235)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
at org.hibernate.loader.Loader.list(Loader.java:2124)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
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:1149)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:67)
... 5 more
Caused by: java.sql.SQLException: ORA-00903: invalid table name

at oracle.jdbc.driver.DatabaseError.throwSqlException
(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8
(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe
(T4CPreparedStatement.java:799)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe
(OracleStatement.java:1039)
at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe
(T4CPreparedStatement.java:839)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout
(OracleStatement.java:1132)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal
(OraclePreparedStatement.java:3285)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery
(OraclePreparedStatement.java:3329)
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:1812)
at org.hibernate.loader.Loader.doQuery(Loader.java:697)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections
(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2232)
... 13 more

Nicolas

unread,
Jan 6, 2010, 6:15:16 AM1/6/10
to play-framework
Yes USER is a reserved keyword. The best is to use a prefix ie
myapp_user.

Nicolas

Nicolas

unread,
Jan 6, 2010, 6:28:46 AM1/6/10
to play-framework
This can be done using the @Table(name = 'myapp_user') on your User
entity...
Reply all
Reply to author
Forward
0 new messages