<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="orders" table="orders" catalog="hibernate">
<id name="oid" type="integer">
<column name="oid" />
<generator class="identity"></generator>
</id>
<property name="price" type="float">
<column name="price" precision="12" scale="0" />
</property>
<property name="id" type="string">
<column name="id" length="10" />
</property>
<many-to-one name="stu" column="id" class="Student"></many-to-one>
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="Student" table="student" catalog="hibernate">
<id name="id" type="string">
<column name="id" length="10" />
<generator class="assigned"></generator>
</id>
<property name="name" type="string">
<column name="name" length="20" />
</property>
<property name="age" type="integer">
<column name="age" />
</property>
<set name="order">
<key column="id"></key>
<one-to-many class="orders"/>
</set>
</class>
</hibernate-mapping>
1 回答
HZK135
TA贡献10条经验 获得超3个赞
<one-to-many class="orders"/> 和 <many-to-one name="stu" column="id" class="Student"></many-to-one> 的class属性要用类的全名
添加回答
举报
0/150
提交
取消