Hi I am trying to fetch some data through a method. My query is working fine in hac but it result null when used in java code. Below is my java code ;-
public class abc
{
@Resource
private UserService userService;
@Resource
private SearchRestrictionService searchRestrictionService;
@Resource
private CatalogVersionService catalogVersionService;
public List<ProductModel> findRequiredProducts()
{
this.userService.setCurrentUser(userService.getAdminUser());
this.searchRestrictionService.disableSearchRestrictions();
this.catalogVersionService.setSessionCatalogVersion("abcCatalog", "Online");
final String query = "select {p:name},{p.creationtime} from {Product! as p}";
final FlexibleSearchQuery productQuery = new FlexibleSearchQuery(query);
final SearchResult<ProductModel> searchResult = getFlexibleSearchService().search(productquery);
this.searchRestrictionService.enableSearchRestrictions();
final List<ProductModel> requiredProducts = searchResult.getResult();
}
}
Here on executing this code I am getting lazylist[null]" in requiredProduct list. Please suggest the solution.