cancel
Showing results for 
Search instead for 
Did you mean: 

extended product type not accessible

0 Kudos
225

i have created a new itemtype fooditem extending product type as below:

 <itemtype code="FoodItem" extends="Product">
             <description>food items</description>
             <attributes>
                 <attribute type="java.lang.Integer" qualifier="price">
                     <persistence type="property"></persistence>
                 </attribute>
             </attributes>
         </itemtype>  

i successfully added 20 rows using impex as follows:

 insert_update FOODITEM  PRICE ; NAME; CODE[unique=true] ; CATALOGVERSION(catalog(id),version)[unique=true] ;  

but when i am trying to access the rows in DAO layer, the flexibleSearchService is returning 0 rows.
The DAO layer code snippet is like below:

 public List<FoodItemModel> getAllFood()
     {
         // XXX Auto-generated method stub
 
         //        catalogVersionService.setSessionCatalogVersion("FoodInSystems", "Online");
         final String query = "select {pk} from {fooditem}";
         final FlexibleSearchQuery fQuery = new FlexibleSearchQuery(query);
         final List<FoodItemModel> items = flexibleSearchService.<FoodItemModel> search(fQuery).getResult();
         LOG.info(fQuery.toString());
         LOG.info("In " + DefaultFoodItemDAO.class.toString() + " , we found " + Integer.toString(items.size()) + " food items");
         LOG.info(Integer.toString(catalogVersionService.getSessionCatalogVersions().size()));
 
         LOG.info(catalogVersionService.getSessionCatalogVersions().toString());
 
         return items;
     }  

and the output looks like below:

 INFO  [hybrisHTTP29] [DefaultFoodItemDAO] query: [select {pk} from {fooditem}], query parameters: [{}]
 INFO  [hybrisHTTP29] [DefaultFoodItemDAO] In class com.infy.daos.impl.DefaultFoodItemDAO , we found 0 food items
 INFO  [hybrisHTTP29] [DefaultFoodItemDAO] 1
 INFO  [hybrisHTTP29] [DefaultFoodItemDAO] [CatalogVersionModel (8796093121113@1)]  


View Entire Topic
dario_petrovic
Discoverer
0 Kudos

Hi ,

Have you checked in ".../hac/console/flexsearch" what do you have in the database. Also, you can easily check catalogversion on items....

 SELECT {fi.pk},{c.id},{cv.version} FROM {FoodItem AS fi JOIN Catalog AS c ON {fi.catalog}={c.pk} JOIN CatalogVersion AS cv ON {fi.catalogversion}={cv.pk}}