於Hibernate HQL語法中若要進行類似 SELECT * FROM USER u WHERE u.username like ('eric%'); 時
在HQL 語法中一般我們直覺會這樣寫
Query query = em.createQuery("SELECT u FROM USER u WHERE u.username like :username'%'").setParameter("username", user.getUsername());
若是這樣,hibernate 在編譯時就會直接賞你個痛快
所以需要再加上一個字元串接的符號,類似這樣才可以
Query query = em.createQuery("SELECT u FROM USER u WHERE u.username like :username ||'%'").setParameter("username", user.getUsername());