[LF7.1] Problem with AssetCategoryProperty

Diego Cantone, modified 6 Years ago. Junior Member Posts: 42 Join Date: 11/10/16 Recent Posts
Hello, while developing on Liferay 7.1, i noticed that the type AssetCategoryProperty has been deprecated and so doesn't appear in the category section in the control panel, but the table still exist on the database,  if i try to add a new one with the following code:
long propertyId = CounterLocalServiceUtil.increment(AssetCategoryProperty.class.getName());
AssetCategoryProperty categoryProperty = AssetCategoryPropertyLocalServiceUtil.createAssetCategoryProperty(propertyId);
                categoryProperty.setKey(key);
                categoryProperty.setValue(value);
                categoryProperty.setCategoryId(categoryId);
                categoryProperty.setCompanyId(company.getCompanyId());
                categoryProperty.setUserId(user.getUserId());
                categoryProperty.setUserName(user.getFullName());
                categoryProperty.setCreateDate(new Date());
                categoryProperty.setModifiedDate(new Date());
                return AssetCategoryPropertyLocalServiceUtil.addAssetCategoryProperty(categoryProperty);

i receive the following error: 
com.liferay.portal.kernel.exception.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: org.hibernate.MappingException: 
​​​​​​​Unknown entity: com.liferay.portlet.asset.model.impl.AssetCategoryPropertyImpl    
at com.liferay.portal.kernel.service.persistence.impl.BasePersistenceImpl.processException(BasePersistenceImpl.java:270) 

Is there a way to add them programatically? There is an alternative to AssetCategoryProperties in Liferay 7.1? Thanks.
thumbnail
Mohammed Yasin, modified 6 Years ago. Liferay Master Posts: 593 Join Date: 8/8/14 Recent Posts
Hi,
You can use this API    AssetCategoryPropertyLocalServiceUtil.addCategoryProperty(serviceContext.getUserId(), 67619, "A", "B");
thumbnail
Fernando Fernandez, modified 6 Years ago. Expert Posts: 401 Join Date: 8/22/07 Recent Posts
In 7.1 you can use import com.liferay.asset.category.property.service.AssetCategoryPropertyLocalServiceUtil;

Categories properties are still configurable in the UI.

In build.gradle you use group: "com.liferay", name: "com.liferay.asset.category.property.api"

HTH

Fernando