我已经阅读了有关SO的StandardServiceRegistryBuilder相关帖子但它似乎无法解决我的问题。这是我试图运行的代码:
import javax.imageio.spi.ServiceRegistry;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class TestHibernate {
public static void main(String args[]){
UserDetails userDetails = new UserDetails();
userDetails.setAge(22);
userDetails.setName("Saurabh");
Configuration configuration = new Configuration();
configuration.configure();
StandardServiceRegistryBuilder serviceRegistryBuilder = new StandardServiceRegistryBuilder(); //this is where i get error
serviceRegistryBuilder.applySettings(configuration.getProperties());
ServiceRegistry serviceRegistry = serviceRegistryBuilder.build();
SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry);
这是netbeans给出的错误:找不到符号。
我该如何解决这个问题。我是hibernate的初学者
答案 0 :(得分:0)
您导入了错误的类,需要
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.boot.registry.StandardServiceRegistry;