我试图在groovy脚本中使用ModelService从数据库中删除一个模型,但它没有删除。
import de.hybris.platform.core.model.order.OrderModel
import de.hybris.platform.ordersplitting.model.ConsignmentModel
List<String> orderList = new ArrayList<>()
orderList.add("P000015003")
OrderModel orderModel = flexibleSearchService.search(String.format("SELECT {PK} FROM {AbstractOrder} WHERE {code} = '%s'", "P000015003")).result.get(0)
ConsignmentModel consignment = orderModel.getConsignments().iterator().next()
ModelService modelService = (ModelService) spring.getBean("modelService");
modelService.remove(consignment)
println("Removed")
2条答案
按热度按时间qnakjoqk1#
您是否已检查“commit”模式是否已打开,如下图所示?
44u64gxh2#
您可以使用transaction执行提交操作: