Monday, October 7, 2013

AnnotationConfiguration is deprecated?

The SessionManager utility class is the famous one among JAVA programmer who has been working with Hibernate.
public class SessionManager {

 private static final SessionFactory sessionFactory = buildSessionFactory();
 
 private static SessionFactory buildSessionFactory() {
  
  try {
   return new AnnotationConfiguration().configure().buildSessionFactory();
  }
  catch( Throwable e ) {
   
   throw new ExceptionInInitializerError(e);
  }
 }
 
 public static SessionFactory getSessionFactory() {
  return sessionFactory;
 }
}

Unfortunately, I just realize that AnnotationConfiguration has already been deprecated Since Hibernate 3.6. Do you know what is the new implementation of this class? Well, replace this with Configuration.

No comments: