<?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">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="dao.app.HuntMethod" table="hunt_method" catalog="test">
<id name="huntMethodId" type="integer">
<column name="hunt_method_id" />
<generator class="increment"></generator>
</id>
<many-to-one name="customer" class="dao.app.Customer" fetch="select">
<column name="customer_id" />
</many-to-one>
<property name="stuName" type="string">
<column name="Stu_name" length="40" not-null="true" />
</property>
<property name="schoolName" type="string">
<column name="School_name" length="60" not-null="true" />
</property>
<property name="huntState" type="string">
<column name="Hunt_state" length="40" />
</property>
<property name="jobState" type="string">
<column name="Job_state" length="40" not-null="true" />
</property>
<property name="subject" type="string">
<column name="subject" length="40" />
</property>
<property name="contactName" type="string">
<column name="Contact_name" length="40" not-null="true" />
</property>
<property name="class_" type="string">
<column name="class" length="20" />
</property>
<property name="contactNum" type="string">
<column name="Contact_num" length="40" not-null="true" />
</property>
</class>
</hibernate-mapping>
<?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">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="dao.app.Customer" table="customer" catalog="test">
<id name="customerId" type="integer">
<column name="customer_id" />
<generator class="increment"></generator>
</id>
<property name="cname" type="string">
<column name="cname" length="40" not-null="true" />
</property>
<property name="password" type="string">
<column name="password" length="80" not-null="true" />
</property>
<property name="sex" type="integer">
<column name="sex" not-null="true" />
</property>
<property name="bornDate" type="string">
<column name="Born_date" length="20" not-null="true" />
</property>
<property name="school" type="string">
<column name="school" length="40" not-null="true" />
</property>
<property name="subject" type="string">
<column name="subject" length="40" />
</property>
<property name="originAddress" type="string">
<column name="Origin_address" length="200" />
</property>
<property name="class_" type="string">
<column name="class" length="20" />
</property>
<property name="cellphone" type="integer">
<column name="cellphone" />
</property>
<property name="email" type="string">
<column name="email" length="100" not-null="true" />
</property>
<property name="photo" type="string">
<column name="photo" length="200" />
</property>
<property name="certificate" type="string">
<column name="certificate" length="25" />
</property>
<property name="studentId" type="string">
<column name="Student_id" length="40" />
</property>
<property name="nickName" type="string">
<column name="Nick_name" length="40" />
</property>
<property name="huntState" type="string">
<column name="Hunt_state" length="40" />
</property>
<property name="workLimit" type="string">
<column name="Work_limit" length="40" />
</property>
<property name="mydate" type="date">
<column name="mydate" length="10" />
</property>
<set name="applies" inverse="true">
<key>
<column name="customer_id" />
</key>
<one-to-many class="dao.app.Apply" />
</set>
<set name="huntMethods" inverse="true" lazy="false">
<key>
<column name="customer_id" />
</key>
<one-to-many class="dao.app.HuntMethod" />
</set>
<set name="colects" inverse="true">
<key>
<column name="customer_id" />
</key>
<one-to-many class="dao.app.Colect" />
</set>
</class>
</hibernate-mapping>
</pre><pre name="code" class="html">
</pre><p>、、、、、、</p><p>实例源代码:</p><p><pre name="code" class="java"> HuntMethod hM =new HuntMethod();
copyVoValuetoHM(vo, hM);
List ls=ctmDao.findByStudentId(vo.getStuID());
if(ls ==null || ls.size()==0){
l.info("this StudentID isn`t exist!!");
return false;
}else{
Customer ctm=(Customer) ls.get(0);
hM.setCustomer(ctm);
huntMethodDao.save(hM);