java - Incorrect Query Building Spring Data JPA Repository For Full Text Search -


i trying make full text search using postgresql database spring boot application.

following query wrote full text search.

public interface productsubcategoryrepository extends jparepository<productsubcategory, long>{             @query(name = "select product_category, product_subcategory, "             + "product_level_category, product, product_attribute "             + "from public.product_category "             + "inner join public.product_subcategory "             + "on (product_category.id = product_subcategory.product_category_id) "             + "inner join public.product_level_category "             + "on (product_subcategory.id = product_level_category.product_sub_category_id) "             + "inner join public.product "             + "on (product_level_category.id = product.product_level_category_id) "             + "inner join product_attribute "             + "on (product.id = product_attribute.product_id) "             + "where to_tsvector(product.name) @@ to_tsquery(:query) "             + "or to_tsvector(product_attribute.name) @@ to_tsquery(:query) "             + "or to_tsvector(product_level_category.name) @@ to_tsquery(:query) "             + "or to_tsvector(product_subcategory.name) @@ to_tsquery(:query)", nativequery = true)             public list<productsubcategory> findproductsubcategoriesbyname(@param("query") string query);     } 

but when run following query on database gui tool (pgadmin). fetching me results. when trying similar query there no results.

the console log showing me incorrect creation of query

2017-07-26 11:37:18.439 debug 6332 --- [nio-8000-exec-3] org.hibernate.sql                        : select productsub0_.id id1_12_, productsub0_.name name2_12_, productsub0_.product_category_id product_4_12_, productsub0_.sub_category_description sub_cate3_12_ public.product_subcategory productsub0_ productsub0_.name=? 2017-07-26 11:37:18.440 trace 6332 --- [nio-8000-exec-3] o.h.type.descriptor.sql.basicbinder      : binding parameter [1] [varchar] - [mid] 


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -