Search code examples
sap-commerce-cloud

Hybris Cant Access comments filed of Customer


I am new to Hybris. My Requirement is to select all customers who have not left comments. I found that Comments have an author field and that I joined two fields of Customers and Comments. Also, I find out that Comment has a comment field which is a collection of comments. The problem is that I can't access to comment field to check if is it null or not.

SELECT * FROM {comment AS ct JOIN customer AS cr ON {ct:author}={cr:pk}} WHERE 

{ct:comment} IS NOT NULL

the exception that hac gives

Exception message: cannot search unknown field 'TableField(name='p_comment',langPK='null',type=comment)

it says there is no comment field


Solution

  • Comment model has text fields, I can't see Comment field on it. Use below query:

    SELECT * FROM {comment AS ct JOIN customer AS cr ON {ct:author}={cr:pk}} 
    WHERE {ct:text} IS NOT NULL