mapping??PUBLIC
?? "-//Hibernate/Hibernate??Mapping??DTD??3.0//EN"
?? "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping??package="com.nintenyun.hibernate">
???? <class??name="Animal"??table="t_animal"??>
?????? <id??name="id"??>
???????? <generator??class="native"/>
?????? </id>
?????? <property??name="name"/>
?????? <property??name="sex"/>
???????? <joined-subclass??name="Pig"??table="t_pig">
?????????? <key??column="pid"/>
?????????? <property??name="weight"/>
???????? </joined-subclass>
???????? <joined-subclass??name="Bird"??table="t_bird">
?????????? <key??column="bid"/>
?????????? <property??name="height"/>
???????? </joined-subclass>
</class>
</hibernate-mapping>
3 μúèyààmapping
1???ó?£Dí
2 mapping ???t
Xml′ú??
<?xml??version="1.0"?>
<!DOCTYPE??hibernate-mapping??PUBLIC
?? "-//Hibernate/Hibernate??Mapping??DTD??3.0//EN"
?? "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping??package="com.nintenyun.hibernate">
???? <class??name="Animal"??table="t_animal"??>
?????? <id??name="id"??>
???????? <generator??class="native"/>
?????? </id>
?????? <property??name="name"/>
?????? <property??name="sex"/>
?????? <union-subclass??name="Pig"??table="t_pig">
?????? <property??name="weight"/>
?????? </union-subclass>
?????? <union-subclass??name="Bird"??table="t_bird">
?????? <property??name="height"/>
?????? </union-subclass>
</class>
</hibernate-mapping>
Hibernate各种映射关系总结(7)
时间:2010-12-14 javaeye nintenyun
6 Component 映射
component不是实体,没有OID。
1 对象模型
public class Employee
private int id
private String name
private Contact contact
-------------------------------------
public class Contact
private String email
private String address
private String zipcode
private String contactTel
-------------------------------------
public class User
private int id
private String name
private Contact contact
2 mapping文件
Xml代码
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.nintenyun.hibernate">
<class name="User" table="t_user" >
<id name="id" >
<generator class="native"/>
</id>
<proper
|