List<?> result = session.createQuery( "from Hypothesis h where h.description LIKE '%cave\\_' ESCAPE '\\'" ).list();
It will throw:
org.hibernate.hql.ParsingException: HQL000006: The query from org.hibernate.ogm.backendtck.queries.Hypothesis h where h.description LIKE '%cave_' ESCAPE '\' is not valid; Found unconsumed token(s): ESCAPE . at org.hibernate.hql.QueryParser.parseQuery(QueryParser.java:75)