我收到错误:ServiceRegistryBuilder
无法解析为某种类型。请帮我解决问题:
import javax.imageio.spi.ServiceRegistry;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class HibernateConnectionUtil {
private static HibernateConnectionUtil instance = null;
private static SessionFactory sessionFactory;
private static ServiceRegistry serviceRegistry;
private HibernateConnectionUtil(){
Configuration configuration = new Configuration();
configuration.configure();
serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).build();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
}
public static HibernateConnectionUtil getInstance(){
if(instance == null){
instance = new HibernateConnectionUtil();
}
return instance;
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}}