Created
July 24, 2012 02:56
-
-
Save pengju/3167733 to your computer and use it in GitHub Desktop.
hibernate中一对多,多对一的映射文件配置
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"> | |
<hibernate-mapping package="com.kaishengit.pojo"> | |
<class name="Address" table="t_address"> | |
<id name="id" column="id"> | |
<generator class="native"></generator> | |
</id> | |
<property name="address" column="address"></property> | |
<many-to-one name="user" class="User" column="user_id"></many-to-one> | |
</class> | |
</hibernate-mapping> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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"> | |
<hibernate-mapping package="com.kaishengit.pojo"> | |
<class name="User" table="t_user"> | |
<id name="id" column="user_id"> | |
<generator class="native"></generator> | |
</id> | |
<property name="name" column="user_name"></property> | |
<property name="password" column="user_password"></property> | |
<set name="addressSet" inverse="true"> | |
<key column="user_id"></key> | |
<one-to-many class="Address"/> | |
</set> | |
</class> | |
</hibernate-mapping> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment