Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: [LF7.1] Problem with AssetCategoryProperty
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:
i receive the following error:
Is there a way to add them programatically? There is an alternative to AssetCategoryProperties in Liferay 7.1? Thanks.
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.
Hi,
You can use this API AssetCategoryPropertyLocalServiceUtil.addCategoryProperty(serviceContext.getUserId(), 67619, "A", "B");
You can use this API AssetCategoryPropertyLocalServiceUtil.addCategoryProperty(serviceContext.getUserId(), 67619, "A", "B");
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
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
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™