1

当任何 impex 行失败时,是否可以从同一个 impex 文件中回滚所有先前导入的行,并停止进一步执行?

4

2 回答 2

1

Impex 导入不支持事务,因此无法回滚。您需要使用 flex 为回滚未来进行自定义开发。另一方面,在交易中更新/插入项目是不可行的,因为成千上万的在线用户可能正在等待网站或服务。

我建议为失败的线路开发通知机制以支持团队。

如果项目可以同步,您可以为它们创建临时目录并在成功导入后同步。

于 2018-10-03T07:11:24.670 回答
1

Transaction如果您使用导入 Impex,您可以使用 hybrisImpexService

Transaction tx = Transaction.current();
tx.begin(); 
boolean success = false;
try
{
   // Import your impex here and catch exceptions that can occur
   doSomeBusinessLogic();
   success = true;
}
finally
{
   if( success )
      tx.commit();
   else
      tx.rollback();
}

您可以在此处找到 hybris 文档:https ://help.hybris.com/1808/hcd/8c7387f186691014922080f2e053216a.html

于 2018-10-03T07:58:13.750 回答