org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: . near line 1, column 168 [UPDATE com.logitags.cibet.actuator.archive.StateArchive a SET a.objectId = :objectId WHERE a.caseId = :caseId AND a.controlEvent = com.logitags.cibet.core.ControlEvent.DELETE]

Hibernate JIRA | Wolfgang Winter | 3 years ago
  1. 0

    I have a named query with an ENUM WHERE parameter defined as: @NamedQuery(name = StateArchive.UPDATE_OBJECTID, query = "UPDATE StateArchive a SET a.objectId = :objectId WHERE a.caseId = :caseId AND a.controlEvent = com.logitags.cibet.core.ControlEvent.DELETE") Creation of the EntityManagerFactory fails with following Exception: {color:red}2013-07-20 11:40:15,605 ERROR [ main] (ErrorCounter.java:reportError:50) - line 1:168: unexpected token: . line 1:168: unexpected token: . at org.hibernate.hql.internal.antlr.HqlBaseParser.primaryExpression(HqlBaseParser.java:876) at org.hibernate.hql.internal.antlr.HqlBaseParser.atom(HqlBaseParser.java:3472) at org.hibernate.hql.internal.antlr.HqlBaseParser.unaryExpression(HqlBaseParser.java:3250) at org.hibernate.hql.internal.antlr.HqlBaseParser.multiplyExpression(HqlBaseParser.java:3122) at org.hibernate.hql.internal.antlr.HqlBaseParser.additiveExpression(HqlBaseParser.java:2828) at org.hibernate.hql.internal.antlr.HqlBaseParser.concatenation(HqlBaseParser.java:568) at org.hibernate.hql.internal.antlr.HqlBaseParser.relationalExpression(HqlBaseParser.java:2595) at org.hibernate.hql.internal.antlr.HqlBaseParser.equalityExpression(HqlBaseParser.java:2551) at org.hibernate.hql.internal.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2420) at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:2346) at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:2301) at org.hibernate.hql.internal.antlr.HqlBaseParser.expression(HqlBaseParser.java:2011) at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalExpression(HqlBaseParser.java:1787) at org.hibernate.hql.internal.antlr.HqlBaseParser.whereClause(HqlBaseParser.java:452) at org.hibernate.hql.internal.antlr.HqlBaseParser.updateStatement(HqlBaseParser.java:222) at org.hibernate.hql.internal.antlr.HqlBaseParser.statement(HqlBaseParser.java:140) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:266) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:180) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168) at org.hibernate.internal.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:1071) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:519) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1751) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:920) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:59) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63){color} and {color:red}2013-07-20 11:40:15,637 ERROR [ main] (SessionFactoryImpl.java:<init>:524) - HHH000177: Error in named query: com.logitags.cibet.actuator.archive.StateArchive.UPDATE_OBJECTID org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: . near line 1, column 168 [UPDATE com.logitags.cibet.actuator.archive.StateArchive a SET a.objectId = :objectId WHERE a.caseId = :caseId AND a.controlEvent = com.logitags.cibet.core.ControlEvent.DELETE] at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54) at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47) at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:79) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:276) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:180) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105){color} However, when I use another ENUM value like com.logitags.cibet.core.ControlEvent.REDO the query passes. I suspect that the Hibernate query parser fails when an ENUM value is an SQL keyword. I tested also with UPDATE and INSERT, they also fail.

    Hibernate JIRA | 3 years ago | Wolfgang Winter
    org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: . near line 1, column 168 [UPDATE com.logitags.cibet.actuator.archive.StateArchive a SET a.objectId = :objectId WHERE a.caseId = :caseId AND a.controlEvent = com.logitags.cibet.core.ControlEvent.DELETE]
  2. 0

    I have a named query with an ENUM WHERE parameter defined as: @NamedQuery(name = StateArchive.UPDATE_OBJECTID, query = "UPDATE StateArchive a SET a.objectId = :objectId WHERE a.caseId = :caseId AND a.controlEvent = com.logitags.cibet.core.ControlEvent.DELETE") Creation of the EntityManagerFactory fails with following Exception: {color:red}2013-07-20 11:40:15,605 ERROR [ main] (ErrorCounter.java:reportError:50) - line 1:168: unexpected token: . line 1:168: unexpected token: . at org.hibernate.hql.internal.antlr.HqlBaseParser.primaryExpression(HqlBaseParser.java:876) at org.hibernate.hql.internal.antlr.HqlBaseParser.atom(HqlBaseParser.java:3472) at org.hibernate.hql.internal.antlr.HqlBaseParser.unaryExpression(HqlBaseParser.java:3250) at org.hibernate.hql.internal.antlr.HqlBaseParser.multiplyExpression(HqlBaseParser.java:3122) at org.hibernate.hql.internal.antlr.HqlBaseParser.additiveExpression(HqlBaseParser.java:2828) at org.hibernate.hql.internal.antlr.HqlBaseParser.concatenation(HqlBaseParser.java:568) at org.hibernate.hql.internal.antlr.HqlBaseParser.relationalExpression(HqlBaseParser.java:2595) at org.hibernate.hql.internal.antlr.HqlBaseParser.equalityExpression(HqlBaseParser.java:2551) at org.hibernate.hql.internal.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2420) at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:2346) at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:2301) at org.hibernate.hql.internal.antlr.HqlBaseParser.expression(HqlBaseParser.java:2011) at org.hibernate.hql.internal.antlr.HqlBaseParser.logicalExpression(HqlBaseParser.java:1787) at org.hibernate.hql.internal.antlr.HqlBaseParser.whereClause(HqlBaseParser.java:452) at org.hibernate.hql.internal.antlr.HqlBaseParser.updateStatement(HqlBaseParser.java:222) at org.hibernate.hql.internal.antlr.HqlBaseParser.statement(HqlBaseParser.java:140) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:266) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:180) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80) at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168) at org.hibernate.internal.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:1071) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:519) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1751) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:94) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:920) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:59) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63){color} and {color:red}2013-07-20 11:40:15,637 ERROR [ main] (SessionFactoryImpl.java:<init>:524) - HHH000177: Error in named query: com.logitags.cibet.actuator.archive.StateArchive.UPDATE_OBJECTID org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: . near line 1, column 168 [UPDATE com.logitags.cibet.actuator.archive.StateArchive a SET a.objectId = :objectId WHERE a.caseId = :caseId AND a.controlEvent = com.logitags.cibet.core.ControlEvent.DELETE] at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54) at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47) at org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:79) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:276) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:180) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136) at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:105){color} However, when I use another ENUM value like com.logitags.cibet.core.ControlEvent.REDO the query passes. I suspect that the Hibernate query parser fails when an ENUM value is an SQL keyword. I tested also with UPDATE and INSERT, they also fail.

    Hibernate JIRA | 3 years ago | Wolfgang Winter
    org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: . near line 1, column 168 [UPDATE com.logitags.cibet.actuator.archive.StateArchive a SET a.objectId = :objectId WHERE a.caseId = :caseId AND a.controlEvent = com.logitags.cibet.core.ControlEvent.DELETE]
  3. 0

    Hibernate Bitwise operation function not getting registered

    Stack Overflow | 3 years ago | Benjamin Beasley
    org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: bitwise_and near line 1, column 354 [select sqrt(pow(rideRequest.startLatitude - p.latitude, 2) + pow(rideRequest.startLongitude - p.longitude, 2)) as distance, p.polyLine.rideOffer as rideOffer, p.polyLine.rideOffer.user, p.polyLine.rideOffer.user.role from com.freeride.lib.domain.Point p, com.freeride.lib.domain.RideRequest rideRequest where rideRequest.id=? and (rideOffer.permissions bitwise_and rideRequest.permissions) = rideRequest.permissions group by p.polyLine.rideOffer order by distance asc]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Error executing query in QueryDSL

    Stack Overflow | 2 years ago | Genzotto
    org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: ( near line 4, column 6 [select count(c) from com.irtve.plataforma.cms.model.Asset c where c.id in (select id from (select max(c.publicationDate) as publication_date, max(c.ctvid), c.programId, c.id as id from com.irtve.plataforma.cms.model.views.ContentCacheView c group by c.programId, c.id order by publication_date desc))]
  6. 0

    How to rewrite given query in jpql custom query?

    Stack Overflow | 2 years ago | iie
    org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: 0 near line 1, column 126 [SELECT h FROM com.iie.model.Host h WHERE h.date between (SELECT subtime((Select max(ho.date) from com.iie.model.Host ho ), 0 0:5:0)) and (Select max(hos.date) from com.iie.model.Host hos)]

    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. org.hibernate.hql.internal.ast.QuerySyntaxException

      unexpected token: . near line 1, column 168 [UPDATE com.logitags.cibet.actuator.archive.StateArchive a SET a.objectId = :objectId WHERE a.caseId = :caseId AND a.controlEvent = com.logitags.cibet.core.ControlEvent.DELETE]

      at org.hibernate.hql.internal.ast.QuerySyntaxException.convert()
    2. Hibernate
      QueryTranslatorImpl.compile
      1. org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
      2. org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
      3. org.hibernate.hql.internal.ast.ErrorCounter.throwQueryException(ErrorCounter.java:79)
      4. org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:276)
      5. org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:180)
      6. org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
      6 frames