如果没有主键 建立的映射文件会是:
<hibernate-mapping>
<class name="iaoc.ItsServer.pojo.SmcSystemuser" table="smc_systemuser" catalog="ebsits_user">
<composite-id name="id" class="iaoc.ItsServer.pojo.SmcSystemuserId">
<key-property name="susAccountid" type="java.lang.String">
<column name="SUS_ACCOUNTID" length="10" />
</key-property>
<key-property name="susUseraccount" type="java.lang.String">
<column name="SUS_USERACCOUNT" length="15" />
</key-property>
</composite-id>
</class>
</hibernate-mapping>
这样的映射文件不能用
加上主键后 效果就完全不同了
<hibernate-mapping>
<class name="iaoc.ItsServer.pojo.SmcSystemuser" table="smc_systemuser" catalog="ebsits_user">
<id name="susAccountid" type="java.lang.String">
<column name="SUS_ACCOUNTID" length="10" />
<generator class="assigned"></generator>
</id>
<property name="susUseraccount" type="java.lang.String">
<column name="SUS_USERACCOUNT" length="15" />
</property>
<property name="susEmployeeid" type="java.lang.String">
<column name="SUS_EMPLOYEEID" length="10" />
</property>
</class>
</hibernate-mapping>
加上主键后,一道香甜可口的映射文件就反转好了!!!欧也!!!卡哇伊!!
( \
\ \
/ / |\\
/ / .-`````-. / ^`-.
\ \ / \_/ {|} `o
\ \ / .---. \\ _ ,--'
\ \/ / \, \( `^^^
\ \/\ (\ )
\ ) \ ) \ \
) /__ \__ ) (\ \___
(___)))__))(__))(__)))