I am using play with JPA with PostgreSQL and having a problem creating a jpql.
Below is my model code
public static List<Jobseekers> search(String key, String keyvalue) {
@SuppressWarnings("unchecked")
List<Jobseekers> empList = JPA.em().createQuery("FROM Jobseekers WHERE :key LIKE :keyvalue").setParameter("key", key).setParameter("keyvalue", "%"+keyvalue+"%").getResultList();
System.out.println("key is"+key);
return empList;
}
so my column name is dynamic in query
The sql that is created is like
select * from jobseekers where 'name' like '%akash%'
where name is the key
The above query gives an empty list because of the appostrophe(') in name column name
My problem is that how to remove appostrophe(') in column name('name') so I can get correct result?