代码之家  ›  专栏  ›  技术社区  ›  Pradip Rahul

如何在Hybris中回滚impex导入

  •  1
  • Pradip Rahul  · 技术社区  · 7 年前

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

    2 回复  |  直到 7 年前
        1
  •  1
  •   alain.janinm    7 年前

    你可以用hybris Transaction ImpexService

    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();
    }
    

    https://help.hybris.com/1808/hcd/8c7387f186691014922080f2e053216a.html

        2
  •  1
  •   mkysoft    7 年前

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

    我建议建立故障线路的通知机制来支持团队。

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