开始学习Hibernate。但是中途遇到了很多问题。
是因为2008的驱动注册,与其他的写法有点不一样。。因该写成这样:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.url">jdbc:sqlserver://127.0.0.1:1433;DatabaseName=stuDB</property> <!-- 注意这儿没得microsoft -->
<property name="hibernate.connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property> <!--而这儿有microsoft,以点隔开-->
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password">123456</property>
<property name="show_sql">ture</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="hibernate.jdbc.batch_size">16</property>
<mapping resource="wu/hibernate/Student.hbm.xml"/>
</session-factory>
</hibernate-configuration>