spring config in 
   <property name="hibernateProperties">
     <props>
       <prop key="hibernate.dialect">org.hibernate.dialect.DerbyDialect</prop>coding....
SessionFactory sf= new org.hibernate.cfg.AnnotationConfiguration()
 .addAnnotatedClass(Myuser.class)
 .configure()
 .buildSessionFactory();here give me a Exception :(
org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
at org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:426)
why???我猜测可能是我的009-7-1 0:45:04 org.hibernate.cfg.Configuration doConfigure
��Ϣ: Configured SessionFactory: null
哪里能找到更多资料??
who help me???

解决方案 »

  1.   

    一种方式:<bean id="dataSource"
      class="org.apache.commons.dbcp.BasicDataSource">
      <property name="driverClassName">
       <value>com.mysql.jdbc.Driver</value>
      </property>
      <property name="url">
       <value>jdbc:mysql://localhost:3306/infoweb</value>
      </property>
      <property name="username">
       <value>root</value>
      </property>
     </bean>
     
     <bean id="sessionFactory"
      class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
      <property name="dataSource">
       <ref bean="dataSource" />
      </property>
      <property name="hibernateProperties">
       <props>
        <prop key="hibernate.dialect">
         org.hibernate.dialect.MySQLDialect
        </prop>
        <prop key="hibernate.show_sql">
            true
        </prop>
        <prop key="hibernate.hbm2ddl.auto">create</prop>
       </props>
      </property>
      <property name="mappingResources">
       <value>com/yxy/entity/Admin.hbm.xml</value>
      </property>
     </bean>二种方式<bean name="sessionFactory"
        class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="configLocation"
    value="classpath:hibernate.cfg.xml">
        </property>
    </bean>