I am having issue this query i am getting error when c doesn't have parent
@Query("SELECT c FROM Category c WHERE (c.parent = NULL OR c.parent.enable = true) AND c.enable = true AND c.alias = ?1") public Category findByAliasEnabled(String alias);
java.lang.NullPointerException: Cannot invoke "Com.entity.category.Category.getId()" because "category" is null
i am tring to get data when c.parent is enable or c doesn't have parent
@Query("SELECT p FROM Product p WHERE p.category.enable= true AND p.category.parent.enable= true AND p.category.parent.enable= true AND p.category.parent.parent.alias LIKE %?1% OR CONCAT(p.id, ' ', p.name, ' ', p.alias, ' ',p.category.alias, ' ',p.category.parent.alias) LIKE %?1%")
Page<Product> findAll(String keyword, Pageable pageable);
retrieve Product entities based on a keyword that can match various fields including the parent and grandparent category aliases, and product fields