【问题标题】:What could spring add to hibernate?spring 可以为休眠添加什么?
【发布时间】:2010-06-29 21:02:06
【问题描述】:

我正在尝试构建 JSF 应用程序,并且正在使用 hibernate 作为 ORM 解决方案。问题是我的代码中充满了复制代码

Transaction tx = null;
Session session = SessionFactoryUtil.getInstance().getCurrentSession();
try {
  tx = session.beginTransaction();

  tx.commit();}

catch(Exception){}

在每个函数中。春天能帮我避免这种情况吗?或者当我发现hibernate充满了功能时它可以添加什么?

【问题讨论】:

    标签: hibernate spring


    【解决方案1】:

    是的,这正是 Spring 可以为您做的事情之一。

    查看参考手册中的chapter on transaction management

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-09
    • 1970-01-01
    • 2019-08-26
    • 1970-01-01
    • 2017-12-28
    相关资源
    最近更新 更多