<hibernate-configuration>
<session-factory>
<property name="show_sql">true </property>
<property name="dialect">org.hibernate.dialect.SQLServerDialect </property>
<!-- JDBCDriver -->
<property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver </property>
<!-- JDBC URL -->
<property name="connection.url">jdbc:sqlserver://localhost:1433;databaseName=test; </property>
<!-- 用户名 -->
<property name="connection.username">sa </property>
<!-- 密码 -->
<property name="connection.password"> </property>
<!-- 关系映射 -->
<mapping resource="com/test/User.hbm.xml"/>
</session-factory>
</hibernate-configuration>
<hibernate-mapping>
<class name="com.test.User">
<id name="id" column="id" type="java.lang.Integer">
<generator class="native"/>
</id>
<property name="name" column="name" type="java.lang.String"/>
<property name="age" column="age" type="java.lang.Integer"/>
</class>
</hibernate-mapping>
hibernate+sql2005配置(转)
最新推荐文章于 2024-07-13 18:02:33 发布