Connection cannot be null when 'hibernate.dialect' not set hibernate4 tomcat7

后端 未结 2 953
广开言路
广开言路 2021-01-16 23:09

I\'ve followed some tutorial in order to set up a web application using spring, hibernate to run on tomcat.

When trying to run my application I get the error \"Conne

2条回答
  •  轮回少年
    2021-01-16 23:52

    Piece of code from the tutorial you mentioned:

        
        
        
            classpath:hibernate.cfg.xml
        
        
            org.hibernate.cfg.AnnotationConfiguration
        
        
            
                ${jdbc.dialect}
                true
            
        
    
    

    This is where hibernate.cfg.xml was specified and, also, where the dialect was put. If you have for the session factory, you don't need it in the hibernate.cfg.xml. I would suggest looking again at that's tutorial source code and adjust your code accordingly.

提交回复
热议问题