我需要在不知道 catalogType 的情况下通过代码获取产品。是否可以在不传递 catalogType 的情况下检索产品?
以下是我尝试过的代码片段:
@Resource
private ProductDao productDao;
@Resource
private CatalogVersionService catalogVersionService;
List<ProductModel> getProductsByCode(String code) {
CatalogVersionModel catalogVersionModel = new CatalogVersionModel();
catalogVersionModel.setVersion("Online");
catalogVersionService.addSessionCatalogVersion(catalogVersionModel);
List<ProductModel> productModels = productDao.findProductsByCode(code);
}
下面是我得到的例外:
{
"errors": [
{
"message": "model CatalogVersionModel (<unsaved>) cannot be serialized due to being modified, new or removed",
"type": "FlexibleSearchError"
}
]
}
我可以知道如何解决上述问题吗?