0

I just want to pass two string to my query with Spring data, my query looks like :

@Query("select ts.talent from T_LinkTalentSkill ts , where ts.skill || '_'||ts.lnLevel in (a,b) group by 1 having count(*)=2 ") public List<T_Talent> searchBySkillTalent(@Param("a") String a,@Param("b") String b); 

i tried to pass a and b but i got : Validation failed for query

5
  • you have a comma before where (,) Commented May 23, 2016 at 18:08
  • thank you i forget about it :p Commented May 23, 2016 at 18:11
  • Since when has "||" been a valid operator in JPQL?! JPQL has CONCAT Commented May 23, 2016 at 18:13
  • when i tested without params like this "in ('1_1','9_1')" it works fine Commented May 23, 2016 at 18:17
  • Not only is || invalid, also COUNT(*) is invalid. Why not read the JPA spec if not believing me? JPQL != SQL Commented May 23, 2016 at 18:19

1 Answer 1

1

To use @Query annotation with native queries you need to use nativeQuery flag with true value, please check below code:

@Query(value = "select ts.talent from T_LinkTalentSkill ts where ts.lnLevel in (?1,?2) group by 1 having count(*)=2", nativeQuery = true) List<T_Talent> searchBySkillTalent(String a,String b); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.