2014-09-02 61 views
0

我需要一些MySQL的代碼轉換爲JPA命名查詢把一些MYSQL的命名查詢

例如

SELECT * FROM電影,其中標題LIKE '%矩陣%'

我會客串它會

@NamedQuery(name = "Movies.findMoviePart", query = "SELECT c FROM Movies c where c.title LIKE '% :title %'")}) 
be but it has some errors 

org.springframework.dao.InvalidDataAccessApiUsageException:org.hibernate.QueryParameterException:could not locate named parameter [title];嵌套的例外是java.lang.IllegalArgumentException異常:org.hibernate.QueryParameterException:無法找到名爲參數[標題]在DAO IMPL

@覆蓋公共目錄getAllPartMovie(字符串名稱){
TypedQuery

代碼查詢= entityManager.createNamedQuery(「Movies.findMoviePart」,Movies.class); query.setParameter(「title」,title); try { return query.getResultList(); (NoResultException ex){// geen record gevonden return null; }

坦克的幫助球員

回答