Hibernate 4 Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set

后端 未结 12 1724
青春惊慌失措
青春惊慌失措 2021-01-17 14:25

I am using Hibernate latest version 4.3.5.Final.

My hibernate.cfg.xml file content:



        
12条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-17 14:49

    This will be OK

    Configuration cfg = new Configuration().configure();
    
    StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
            .applySettings(cfg.getProperties()).build();
    
    SessionFactory sf = cfg.buildSessionFactory(serviceRegistry);
    
    Session session = sf.openSession();
    

提交回复
热议问题