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:
Post a Comment