【问题标题】:Write to multiple DB in single transaction in hibernate在休眠中的单个事务中写入多个数据库
【发布时间】:2016-03-08 04:30:43
【问题描述】:

我有一个需要写入多个数据库的要求。如果在写入任何数据库时发生任何异常,我想回滚所有内容。

例如

Session userSession= a.getUserDBSession();
Session departmentSession= a.getDepartmentSession();
Session carSession= a.getCarSession();

//Do some work and write to User DB
// Do some work and write to Department DB
//Do some work and write to Car DB
// commit everything.

注意:会话是休眠会话 任何帮助将不胜感激

【问题讨论】:

    标签: java hibernate jdbc transactions hibernate-session


    【解决方案1】:

    您可以尝试将 Atomikos 与休眠一起使用。

    检查下面的链接。

    http://www.atomikos.com/Documentation/HibernateThreeStandalone

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-11-11
      • 1970-01-01
      • 2017-06-05
      • 1970-01-01
      • 2011-08-16
      • 1970-01-01
      相关资源
      最近更新 更多