MySQL Forums
Forum List  »  Connector/JDBC and Java

Exceptions of mysql jdbc with table named condition in java
Posted by: Daniel Petersen
Date: May 03, 2012 10:28AM

I'm working with EclipseIndigo, EclipseLink and MySQL I have a table called condition I need to keep it with that name but when I execute this command "Query qb = em.createQuery("SELECT c FROM Condition c ")" in eclipse it throws this exception:

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'condition' at line 1
at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(
at com.mysql.jdbc.Util.getInstance(
at com.mysql.jdbc.SQLError.createSQLException(
at com.mysql.jdbc.MysqlIO.checkErrorPacket(
at com.mysql.jdbc.MysqlIO.checkErrorPacket(
at com.mysql.jdbc.MysqlIO.sendCommand(
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(
at com.mysql.jdbc.ConnectionImpl.execSQL(
at com.mysql.jdbc.PreparedStatement.executeInternal(
at com.mysql.jdbc.PreparedStatement.executeQuery(
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeSelect(
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(

I know that MySQL has a command called condition and that's why this command throws me an exception. The question is: there is a form to keep my table named as condition and I can execute this command Query qb = em.createQuery("SELECT c FROM Condition c ")"?

Options: ReplyQuote

Written By
Exceptions of mysql jdbc with table named condition in java
May 03, 2012 10:28AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.