java.lang.reflect.InvocationTargetException

Hibernate JIRA | Martin Makundi | 9 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    The delete fails and throws org.hibernate.exception.SQLGrammarException when trying to issue delete: createQuery("DELETE FROM " + TheClassIWantToDelete.class.getSimpleName() + " mhl WHERE " + "mhl.theBridgingClass.theSelectingClass=:theSelectingClass" + " AND (mhl.value=0 OR mhl.value IS NULL)") .setParameter("theSelectingClass", theSelectingClass); I have three Entities: @Entity public class TheClassIWantToDelete{ @Id Long id; @ManyToOne(optional=false) private TheBridgingClass theBridgingClass; @Column private Integer value; ... } @Entity public class TheBridgingClass{ @Id Long id; @ManyToOne(optional=false) private TheSelectingClass theSelectingClass; ... } @Entity public class TheSelectingClass{ @Id Long id; ... } The result is (trace): Hibernate: delete from TheClassIWantToDelete, TheBridgingClass theBridgingCl1_ where theSelectingClass_id=? and (value=0 or value is null) 2008-08-31 12:00:00,912 59846 [btpool0-3] ERROR JDBCExceptionReporter - 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 'where theSelectingClass_id=5 and (value=0 or value is null)' at line 1 java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute update query at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:637) at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:58) Caused by: org.hibernate.exception.SQLGrammarException: could not execute update query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:84) at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:396) at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:259) at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1141) at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94) at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:49) ... 38 more Caused by: com.mysql.jdbc.exceptions.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 'where project_id=5 and (monthlyHoursLimit=0 or monthlyHoursLimit is null)' at line 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2941) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1623) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1715) at com.mysql.jdbc.Connection.execSQL(Connection.java:3249) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1268) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1541) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1455) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1440) at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:75) ... 43 more

    Hibernate JIRA | 9 years ago | Martin Makundi
    java.lang.reflect.InvocationTargetException
  2. Speed up your debug routine!

    Automated exception search integrated into your IDE

  3. 0

    The delete fails and throws org.hibernate.exception.SQLGrammarException when trying to issue delete: createQuery("DELETE FROM " + TheClassIWantToDelete.class.getSimpleName() + " mhl WHERE " + "mhl.theBridgingClass.theSelectingClass=:theSelectingClass" + " AND (mhl.value=0 OR mhl.value IS NULL)") .setParameter("theSelectingClass", theSelectingClass); I have three Entities: @Entity public class TheClassIWantToDelete{ @Id Long id; @ManyToOne(optional=false) private TheBridgingClass theBridgingClass; @Column private Integer value; ... } @Entity public class TheBridgingClass{ @Id Long id; @ManyToOne(optional=false) private TheSelectingClass theSelectingClass; ... } @Entity public class TheSelectingClass{ @Id Long id; ... } The result is (trace): Hibernate: delete from TheClassIWantToDelete, TheBridgingClass theBridgingCl1_ where theSelectingClass_id=? and (value=0 or value is null) 2008-08-31 12:00:00,912 59846 [btpool0-3] ERROR JDBCExceptionReporter - 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 'where theSelectingClass_id=5 and (value=0 or value is null)' at line 1 java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute update query at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:637) at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:58) Caused by: org.hibernate.exception.SQLGrammarException: could not execute update query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:84) at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:396) at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:259) at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1141) at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94) at org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:49) ... 38 more Caused by: com.mysql.jdbc.exceptions.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 'where project_id=5 and (monthlyHoursLimit=0 or monthlyHoursLimit is null)' at line 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2941) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1623) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1715) at com.mysql.jdbc.Connection.execSQL(Connection.java:3249) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1268) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1541) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1455) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1440) at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:75) ... 43 more

    Hibernate JIRA | 9 years ago | Martin Makundi
    java.lang.reflect.InvocationTargetException
  4. 0

    Hibernate: Exception in thread "main" org.hibernate.exception.SQLGrammarException: Unknown column 'DTYPE' in 'field list'

    Stack Overflow | 4 years ago | Harmeet Singh Taara
    com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column 'DTYPE' in 'field list'

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.mysql.jdbc.exceptions.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 'where project_id=5 and (monthlyHoursLimit=0 or monthlyHoursLimit is null)' at line 1

      at com.mysql.jdbc.SQLError.createSQLException()
    2. MySQL jdbc
      PreparedStatement.executeUpdate
      1. com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
      2. com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2941)
      3. com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1623)
      4. com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1715)
      5. com.mysql.jdbc.Connection.execSQL(Connection.java:3249)
      6. com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1268)
      7. com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1541)
      8. com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1455)
      9. com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1440)
      9 frames
    3. Hibernate
      BasicExecutor.execute
      1. org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:75)
      1 frame
    4. Hibernate
      JDBCExceptionHelper.convert
      1. org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
      2. org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
      2 frames
    5. Hibernate
      BasicExecutor.execute
      1. org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:84)
      1 frame
    6. Hibernate HQL/JP-QL Parser
      QueryTranslatorImpl.executeUpdate
      1. org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:396)
      1 frame
    7. Hibernate
      QueryImpl.executeUpdate
      1. org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:259)
      2. org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1141)
      3. org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)
      3 frames
    8. Hibernate EJB
      QueryImpl.executeUpdate
      1. org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:49)
      2. org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:637)
      3. org.hibernate.ejb.QueryImpl.executeUpdate(QueryImpl.java:58)
      3 frames