I have a entity as below I want to query all row where logInId does not start with “5” I tried below code: the above code didn’t work. what is the right way to use NOT LIKE in HQL Answer In your query there’s an error: become: e.logInId is string, so you must quote your condition 5%.