Wednesday, August 25, 2021

hibernate: java.lang.IllegalArgumentException: org.hibernate.QueryException: Unable to resolve path


 >PROBLEM


java.lang.IllegalArgumentException: org.hibernate.QueryException: Unable to resolve path [e.title], unexpected token [e] [select e from br.com.adr.model.entity.security.uni.RoleEntity WHERE e.title = :title]



>SOLUTION


Original code:

String sql = "select e from " + this.entityName + " WHERE e.title = :title";

Query query = em.createQuery(sql, RoleEntity.class);

query.setParameter("title", title);


Fixing the code:

Missing the 'e' entity alias:

String sql = "select e from " + this.entityName + " e WHERE e.title = :title";


>ENV

Windows 10
JSF 2.2
WildFly 21

No comments:

Post a Comment

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...