日期:2014-05-17 浏览次数:20688 次
<class name="Error" table="error_table">
<id name="error_id" column="error_id">
<generator class="identity"/>
</id>
<property name="report_time" type="java.util.Date"/>
<property name="report_user" type="java.lang.String"/>
<property name="report_dep" type="java.lang.String"/>
<property name="error_show_des" type="java.lang.String"/>
<property name="level" type="java.lang.Integer"/>
<property name="report_status" type="java.lang.Integer"/>
<!-- 到User表的外键,N->1 -->
<many-to-one name="user" class="User">
<column name="userid"></column>
</many-to-one>
<many-to-one name="platform" class="Platform">
<column name="platform_id"></column>
</many-to-one>
</class>
<class name="User" table="user_table">
<id name="userid">
<generator class="identity"/>
</id>
<property name="username"/>
<property name="password"/>
<property name="name"/>
<property name="birthday"/>
<property name="email"/>
<property name="cellphone"/>
<!-- dep_id 是 user中的属性,columnid应该是外键 -->
<many-to-one name="dep" cascade="all" class="Department" column="dep_id" />
</class>
this.setError((Error)sess.get(Error.class,error.getError_id()));
<td>记录人</td><td><label><s:property value="%{error.user.username}"/></label> </td></tr>
System.out.println(error.getUser().getUsername());