如何为Hibernate解析“覆盖已弃用的API”?

时间:2016-09-07 21:36:11

标签: java hibernate

我构建了一个java class,因为我可以使用Hibernate。当我选择NetBeans选项:“clean and build”时,系统会向我显示下一个问题:

Note: /home/.../NewHibernateUtil.java uses or overrides a deprecated API.

这是我的类NewHibernateUtil:

package bean.utilitaria;

import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.SessionFactory;

public class NewHibernateUtil {

    private static final SessionFactory sessionFactory;

    static {
        try {
            sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory();
        } catch (Throwable ex) {
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }

    public static SessionFactory getSessionFactory() {
        return sessionFactory;
    }
}

我如何纠正这个问题?

谢谢!

0 个答案:

没有答案