11-15 12:12
Recent Posts
Recent Comments
๊ด€๋ฆฌ ๋ฉ”๋‰ด

miinsun

[JPA-DATA] Validation failed for query for method public abstract java.util.List ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• ๋ณธ๋ฌธ

WebApp/Spring

[JPA-DATA] Validation failed for query for method public abstract java.util.List ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

miinsun 2022. 2. 27. 18:23

๐Ÿ“Œ ์›์ธ : @Query ์‚ฌ์šฉ

@Query(value = "SELECT * FROM place_keyword pk "+ 
			"ORDER BY (CASE WHEN pk.keyword_id = :keyword THEN 1 ELSE 2 END)")
List<PlaceKeyword> findPlaceKeywordBykeyword(@Param(value = "keyword") int keyword);

 

โŒ ์—๋Ÿฌ

์œ„์˜ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰์‹œํ‚ค๊ณ ์ž ํ–ˆ๋Š”๋ฐ

์ด๋Ÿฐ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค...

 

@Query ์–ด๋…ธํ…Œ์ด์…˜์„ ์‚ฌ์šฉํ•ด MySQL, Oracle ๋“ฑ ๋„ค์ดํ‹ฐ๋ธŒ ์ฟผ๋ฆฌ๋ฅผ ์ˆ˜ํ–‰ํ•˜๋ ค๋ฉด

์•„๋ž˜์™€ ๊ฐ™์ด native Query ์†์„ฑ์„ true๋กœ ์„ค์ •ํ•ด์ค˜์•ผ ํ•œ๋‹ค.

nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.dalc.one.repository.PlaceRepository.findAIPlaceList(int)!

 

๐Ÿ“Œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

 

 

@Query(value = "SELECT * FROM place_keyword pk "+ 
			"ORDER BY (CASE WHEN pk.keyword_id = :keyword THEN 1 ELSE 2 END)", nativeQuery = true)
List<PlaceKeyword> findPlaceKeywordBykeyword(@Param(value = "keyword") int keyword);

 

 

Comments