Tuesday, August 21, 2007

java.lang.NoSuchMethodError: org.hibernate.hql.antlr.HqlBaseParser.recover

Problem:
After a deployment to our prod server, some pages do not display and we see this error in the logs:
java.lang.NoSuchMethodError: org.hibernate.hql.antlr.HqlBaseParser.recover(Lantlr/RecognitionException;Lantlr/collections/impl/BitSet;)V

It smells like a lib issue, but its not, its actually an HQL syntax issue

the offending HQL was this - can you spot the problem:
'select dattrDesc, dattrDesc.deviceLocalContent.displayName, dattrDesc.deviceLocalContent.deviceContentId, dattrDesc.attributeName, dattrDesc.attributeValue, dattrDesc.link, '', '', '' from DeviceAttributes dattrDesc'
this thing was commited into a database table.

Solution:
This part , '', '', '' created an issue, it should have been , '''', '''', '''' to escape the quotes for SQL.

7 comments:

  1. thanks! couldn't see how to quote a quote in HQL until I spotted this!

    ReplyDelete
  2. But don't quote a quote quote unless you also quote the quote quote quote.

    ReplyDelete
  3. Can I quote you on that?

    ReplyDelete
  4. THANKS FOR POSTING.

    I TOO FACED THE PROBLEM.
    NOW RESOLVED.
    THANK YOU SOOOOO MUCH

    ReplyDelete
  5. la ni la hu na ji pola ki kola

    ReplyDelete