1

I built an java class for I can use Hibernate. When I select the NetBeansoption: "clean and build", the system indicate me the next problem:

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

This is my class 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;
    }
}

How I can correct this problem?

Thank you!

  • Doesn't it give you more details? Like: What exactly is the deprecated API? And usually the javadoc of a deprecated method/class should tell you what to use instead. – Marvin Sep 07 '16 at 21:38
  • Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. – Juan Camacho Sep 07 '16 at 21:39
  • Does this help? http://stackoverflow.com/questions/8621906/is-buildsessionfactory-deprecated-in-hibernate-4 – Marvin Sep 07 '16 at 21:42

0 Answers0