Uploaded image for project: 'Hibernate ORM'
  1. HHH-10953

HQL update statement fails if entity is inside a package of format in.mycomany.domain.Entity

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.1.0, 5.0.9, 5.2.1
    • Fix Version/s: 5.2.2, 5.1.1, 5.0.11
    • Component/s: hibernate-core
    • Labels:
    • Environment:
      I am using Hibernate via Querydsl
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      My company domain is of the format mycomany.in

      I have changed my project's package from com.mycompany -> in.mycompany to keep it consistent with my company's domain.

      After the migration, hibernate update queries are failing saying

      unexpected token: in
      antlr.NoViableAltException: unexpected token: in
      

      The actual query that ran was of this format

      update Entity e
      set e.prop = ?1
      where e.id = ?2
      

      Here is the cleaned log

      QueryTranslatorImpl: parse() - HQL: update in.mycompany.domain.Entity e
      set e.prop = ?1
      where e.id = ?2
      ErrorCounter: line 1:8: unexpected token: in
      

      This error occurs only for update statement, but not for select for some reason.

      This error occurs in org.hibernate.hql.internal.ast.QueryTranslatorImpl in the following section.

      	private HqlParser parse(boolean filter) throws TokenStreamException, RecognitionException {
      		// Parse the query string into an HQL AST.
      		final HqlParser parser = HqlParser.getInstance( hql );
      		parser.setFilter( filter );
      
      		LOG.debugf( "parse() - HQL: %s", hql );
      		parser.statement();
                      ....
      	}
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: