SQLServer数据库 下图为Student表。
ps:Student表中StudentNo(数据类型nvarchar(50),非标识列)字段为id,并且与其他表有主外键关系
hibernate映射文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.blue.entity.Student" table="Student" >
<id name="stuNo" column="StudentNo">
<generator class=""></generator>
</id>
<property name="stuPwd" column="loginPwd"></property>
<property name="stuName" column="StudentName"></property>
<property name="stuSex" column="Sex"></property>
<property name="stuGradeId" column="GradeId"></property>
<property name="stuPhone" column="Phone"></property>
<property name="stuAddress" column="Address"></property>
<property name="stuDate" column="BornDate"></property>
<property name="stuEmail" column="Email"></property>
</class>
</hibernate-mapping>
我要向数据库中添加数据(insert),该怎么选择主键生成策略?