我实在是没辙了,在java配置之路上遭遇重重阻隔,忙hibernate的配置就是半天
现在出现了这个异常,表面上非常明显,最后的原因却让我非常郁闷!!这是简单的Bean
package test;
public class TestBean{
        private int id;
        private String name;
        private int age;
        public TestBean(){
        }
        public void setName(String name){
                this.name=name;
        }
        public void setId(int id){
                this.id=id;
        }
...}//Hibernate.properties文件hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.connection.username=sa
hibernate.connection.password=orionline
hibernate.connection.driver_class=com.microsoft.jdbc.sqlserver.SQLServerDriver
hibernate.connection.url=jdbc:microsoft:sqlserver://localhost;DatabaseName=JSNNews//HibernateTest.java文件,测试代码就在这里TestBean tb = new TestBean();
        tb.setName("jen");
        tb.setAge(23);
        try {
            SessionFactory sessionFactory;
            Configuration config = new Configuration();
            config.addClass(TestBean.class);
            sessionFactory = config.buildSessionFactory();//该处异常
            Session session = sessionFactory.openSession();
            session.save(tb);
        } catch (Exception e) {
            e.printStackTrace();
        }
异常信息
org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
无论我怎样改这个dialect属性,都不能解决异常,最后实在没辙把Hibernate.properties文件的头字母改成小写,居然Ok了这也给我提了个醒,在java领域,再小的细节都不能放过,否则,就能让中国人喊意大利万岁