0

I am new to floexible search query in hybris I need to delete the cart entries with specific product id- I am using the below query to get the entries

SELECT {products.PK} FROM {Product AS products JOIN CartEntry  AS carts ON {products.PK} = {CartEntry.PRODUCT} } Where {products.PK} ='<PK of the product>'

I keep getting the below exception message.Is there anything i am missing

Exception message: cannot find (visible) type for alias CartEntry within [carts:CartEntry, products:Product]

user964819
  • 343
  • 3
  • 6
  • 24

2 Answers2

2

Try with the following query :

SELECT {products.PK} FROM {Product AS products JOIN CartEntry  AS carts ON {products.PK} = {carts.product} } Where {products.PK} ='<PK of the product>'

Hope this helps

Benkerroum Mohamed
  • 1,867
  • 3
  • 13
  • 19
1

The problem is that you are mixing both, alias and actual name of the itemtype i.e. {products.PK} = {CartEntry.PRODUCT} where products is an alias while CartEntry is an actual name of the itemtype. The following will work:

SELECT {products.PK} FROM {Product AS products JOIN CartEntry  AS carts ON {products.PK} = {carts.product} } WHERE {products.PK} ='<PK of the product>'

You can also use any of the following:

SELECT {Product.PK} FROM {Product JOIN CartEntry ON {Product.PK} = {CartEntry.product} } WHERE {Product.PK} ='<PK of the product>'

SELECT {PK} FROM {Product}, {CartEntry}  WHERE {Product.PK} = {CartEntry.product} AND {Product.PK} ='<PK of the product>'

SELECT {PK} FROM {Product AS products}, {CartEntry AS carts}  WHERE {products.PK} = {carts.product} AND {products.PK} ='<PK of the product>'

SELECT {products.PK} FROM {Product AS products}, {CartEntry AS carts}  WHERE {products.PK} = {carts.product} AND {products.PK} ='<PK of the product>'
Arvind Kumar Avinash
  • 71,965
  • 6
  • 74
  • 110