<?xml version="1.0" encoding="UTF-8"?>
<!-- Hibernate 映射文件的文件头,包含DTD等信息 -->
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!-- 映射News持久化类 -->
<class name="org.yeeku.model.News" table="news">
<!-- 映射标识属性 -->
<id name="id" column="id" unsaved-value="null">
<!-- 定义主键生成器策略 -->
<generator class="nicrement">
</generator>
</id>
<!-- 映射关联类Category -->
<many-to-one name="category" class="org.yeeku.model.Category" column="category_id" not-null="true">
</many-to-one>
<!-- 设置最后评论日期属性 -->
<property name="lastModifyDate" column="last_modify_date" not-null="true">
</property>
<property name="postDate" column="post_date" not-null="true">
</property>
<many-to-one name="poster" column="username" not-null="true">
</many-to-one>
<property name="content" column="content" length="3000" not-null="true">
</property>
<property name="title" column="title" length="50" not-null="true">
</property>
<!-- 映射关联类NewsReview,映射1-N关联 -->
<set name="newsReviews" lazy="false" inverse="true" cascade="all-delete-orphan">
<meta attribute="field-description">
@hibernate.list lazy="true" inverse="false" cascade="none"
@hibernate.collection-key column="id"
@hibernate.collection-one-to-many class="org.yeeku.model.NewsReview"
</meta>
<key>
<column name="news_id" />
</key>
<one-to-many class="org.yeeku.model.NewsReview" />
</set>
</class>
</hibernate-mapping>
<!-- Hibernate 映射文件的文件头,包含DTD等信息 -->
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!-- 映射News持久化类 -->
<class name="org.yeeku.model.News" table="news">
<!-- 映射标识属性 -->
<id name="id" column="id" unsaved-value="null">
<!-- 定义主键生成器策略 -->
<generator class="nicrement">
</generator>
</id>
<!-- 映射关联类Category -->
<many-to-one name="category" class="org.yeeku.model.Category" column="category_id" not-null="true">
</many-to-one>
<!-- 设置最后评论日期属性 -->
<property name="lastModifyDate" column="last_modify_date" not-null="true">
</property>
<property name="postDate" column="post_date" not-null="true">
</property>
<many-to-one name="poster" column="username" not-null="true">
</many-to-one>
<property name="content" column="content" length="3000" not-null="true">
</property>
<property name="title" column="title" length="50" not-null="true">
</property>
<!-- 映射关联类NewsReview,映射1-N关联 -->
<set name="newsReviews" lazy="false" inverse="true" cascade="all-delete-orphan">
<meta attribute="field-description">
@hibernate.list lazy="true" inverse="false" cascade="none"
@hibernate.collection-key column="id"
@hibernate.collection-one-to-many class="org.yeeku.model.NewsReview"
</meta>
<key>
<column name="news_id" />
</key>
<one-to-many class="org.yeeku.model.NewsReview" />
</set>
</class>
</hibernate-mapping>