替换为Hibernate中的org.hibernate.Transactions.isActive()5 [英] Replacement for org.hibernate.Transactions.isActive() in Hibernate 5

查看:389
本文介绍了替换为Hibernate中的org.hibernate.Transactions.isActive()5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从hibernate 4.2.17迁移到5.0.7,到目前为止工作正常,但似乎不推荐使用 isActive 方法。

这是我的代码:

  public void starteTransaktion(){
try {
getMySession();

if(!hibernateSession.getTransaction()。isActive()){
hibernateSession.beginTransaction();

catch(HibernateException e){

}
}

我替换了所有其他方法,但我无法完全找到替代方法......



错误消息:方法 isActive()未定义为类型Transaction

解决方案

href =http://docs.jboss.org/hibernate/orm/5.0/javadocs/org/hibernate/resource/transaction/spi/TransactionStatus.html =noreferrer> 5.0 Javadoc :



hibernateSession.getTransaction()。getStatus()!= TransactionStatus.ACTIVE


I'm migrating from hibernate 4.2.17 to 5.0.7 which works fine so far, but it seems that the method isActive is deprecated. I just can't use it anymore.

Here's my code:

public void starteTransaktion() {
        try {
            getMySession();

            if(!hibernateSession.getTransaction().isActive()) {
                hibernateSession.beginTransaction();
            }
        } catch (HibernateException e) {

        }
    }

I substituted all other methods, but I can't quite find a replacement for this...

Error message: The method isActive() is undefined for the type Transaction

解决方案

As per 5.0 Javadoc:

hibernateSession.getTransaction().getStatus() != TransactionStatus.ACTIVE

这篇关于替换为Hibernate中的org.hibernate.Transactions.isActive()5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆