【问题标题】:org.springframework.orm.hibernate4 alternate for spring hibernateTemplate?org.springframework.orm.hibernate4 替代 spring hibernateTemplate?
【发布时间】:2012-05-02 13:47:30
【问题描述】:

在 Hibernate3 中我正在使用

String[] paramNames = {PARAMS};
Object[] values = { VALUES};
Collection coll= this.getHibernateTemplate().findByNamedQueryAndNamedParam(Person.QUERY_STATUS, paramNames, values);

但现在我必须使用休眠 4.1.1。但是org.springframework.orm.hibernate4不支持hibernateTemplate。现在该怎么做?请指教..

【问题讨论】:

    标签: hibernate


    【解决方案1】:

    在 SPring 3.1 和 Hibernate 4 中不支持 HibernateTemplate,因此您应该使用原生 Hibernate API。

    不建议再使用 HibernateTemplate(大约从 hibernate 3.0.1 的发布)没有更多的附加值所以不是 将不再在那里进行休眠 4. 只需使用平原 SessionFactory 并使用 getCurrentSession 方法获取 当前事务会话(不要使用 openSession !!!!!!) 很高兴...

    【讨论】:

      猜你喜欢
      • 2012-04-04
      • 1970-01-01
      • 2016-02-27
      • 2012-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多