我将如何指定一个JPA查询,例如:
Query q = em.createQuery( "SELECT x FROM org.SomeTable x WHERE x.someString LIKE '%:someSymbol%'" );
其次是:
q.setParameter("someSymbol", "someSubstring");
而不会触发
org.hibernate.QueryParameterException: could not locate named parameter [id]
非常感激!
怎么样
Query q = em.createQuery( "SELECT x FROM org.SomeTable x WHERE x.someString LIKE :someSymbol" ); q.setParameter("someSymbol", "%someSubstring%");
我很确定我曾经解决过您的问题。