不赞成使用的hibernate getSession()。connection() [英] Alternative of deprecated hibernate getSession().connection()

查看:349
本文介绍了不赞成使用的hibernate getSession()。connection()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用HibernateDaoSupport类时,我发现getSession().connection();已被弃用。



请问另一种方法是什么,而不是这个

解决方案

现在我们必须使用 session.doWork() API:

  session.doWork(
new Work(){
public void execute(Connection connection)throws SQLException
{
doSomething(connection);
}
}
);

另请参阅: session.connection()在Hibernate上已弃用?


When using HibernateDaoSupport class,I found that getSession().connection(); is deprecated.

What is another method,please,instead of this

解决方案

Now we have to use session.doWork() API:

session.doWork(
        new Work() {
            public void execute(Connection connection) throws SQLException 
            { 
                doSomething(connection); 
            }
        }
    );

Refer also :session.connection() deprecated on Hibernate?

这篇关于不赞成使用的hibernate getSession()。connection()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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