posts - 0,  comments - 5,  trackbacks - 0
包含4个表,文章分类,文章,文章评论,文章评论回复
文章分为三级目录,bigSortID,secondSordID,smallSortID
  1<?xml version="1.0"?>
  2<!DOCTYPE hibernate-mapping
  3PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
  4"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
  5<hibernate-mapping>
  6 <class name="news.entity.ArticleSort" dynamic-insert="true" dynamic-update="true"  table="art_sort">
  7    <id name="id" type="java.lang.Integer" unsaved-value="null" >
  8        <column name="id" not-null="true"/>
  9        <generator class="native"/>
 10    </id>
 11    <property name="sortName" />
 12    <property name="parentID" />
 13    <property name="createDate" />
 14    <property name="editDate" />
 15    <property name="orderBy" />
 16    <property name="descript" />
 17    <property name="editUser" />
 18    <property name="sortType" />
 19    <property name="isOpen" />
 20    
 21    <!-- 小类对应的文章 -->
 22    <set name="article" inverse="false" lazy ="true" order-by=" id " cascade="none"> 
 23       <key column="smallSortID"/>
 24       <one-to-many class="news.entity.Article"  />
 25    </set>
 26    
 27    <!-- 小类对应的大类 -->
 28    <many-to-one  insert="false" update="false" name="parentBigSort" 
 29            class = "news.entity.ArticleSort"
 30            column = "parentID" />
 31            
 32     <!-- 大类对应小类 -->
 33     <set name="smallSortSet" inverse="false" lazy ="true" order-by=" id " cascade="none"> 
 34       <key column="parentID"/>
 35       <one-to-many class="news.entity.ArticleSort"  />
 36    </set>
 37</class>
 38</hibernate-mapping>
 39
 40
 41<?xml version="1.0"?>
 42<!DOCTYPE hibernate-mapping
 43PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
 44"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
 45<hibernate-mapping>
 46 <class name="news.entity.Article" dynamic-insert="true" dynamic-update="true" lazy="false" table="art_news">
 47    <id name="id" type="java.lang.Integer" unsaved-value="null" >
 48        <column name="id" not-null="true"/>
 49        <generator class="native"/>
 50    </id>
 51    <property name="title" />
 52    <property name="subTitle" />
 53    <property name="author" />
 54    <property name="source" />
 55    <property name="url" />
 56    <property name="picUrl" />
 57    <property name="bigSortID" />
 58    <property name="secondSortID" />
 59    <property name="smallSortID" />
 60    <property name="content" />
 61    <property name="hitCount" />
 62    <property name="isPublish" />
 63    <property name="isTop" />
 64    <property name="createDate" />
 65    <property name="publishDate" />
 66    <property name="editDate" />
 67    <property name="editUser" />
 68    <property name="addUser"/>
 69    <!-- 文章类别 -->
 70    <many-to-one name="articleSort" insert="false" update="false"
 71        class = "news.entity.ArticleSort"  column = "secondSortID" />
 72</class>
 73</hibernate-mapping>
 74
 75
 76<?xml version="1.0"?>
 77<!DOCTYPE hibernate-mapping
 78PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
 79"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
 80<hibernate-mapping>
 81 <class name="news.entity.ArticleRemark" dynamic-insert="true" dynamic-update="true" lazy="false" table="art_remark">
 82    <id name="id" type="java.lang.Integer" unsaved-value="null" >
 83        <column name="id" not-null="true"/>
 84        <generator class="native"/>
 85    </id>
 86    <property name="newsId" />
 87    <property name="userName" />
 88    <property name="title" />
 89    <property name="contact" />
 90    <property name="checkFlag" />
 91    <property name="replyFlag" />
 92    <property name="creDate" />
 93    <property name="checkDate" />
 94    <property name="userIp" />
 95    <property name="checkUserId" />
 96    <many-to-one name="article"  insert="false" update="false" outer-join="false"
 97            class = "news.entity.Article"
 98            column = "newsId" />
 99                
100    <set name="remarkReply" inverse="true" lazy ="true" order-by="replyTime desc" where=" flag=0 " table="art_remark_reply"  cascade="all"> 
101       <key column="remarkId"/>
102       <one-to-many class="news.entity.ArticleRemarkReply"  />
103    </set>
104    
105</class>
106</hibernate-mapping>
107
108
109<?xml version="1.0"?>
110<!DOCTYPE hibernate-mapping
111PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
112"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
113<hibernate-mapping>
114 <class name="news.entity.ArticleRemarkReply" dynamic-insert="true" dynamic-update="true" lazy="false" table="art_remark_reply">
115    <id name="id" type="java.lang.Integer" unsaved-value="null" >
116        <column name="id" not-null="true"/>
117        <generator class="native"/>
118    </id>
119    <property name="remarkId" />
120    <property name="content" />
121    <property name="flag" />
122    <property name="replyDate" />
123    <property name="userName" />
124    <property name="userID" />
125</class>
126</hibernate-mapping>
posted on 2007-09-07 10:09 crazy 阅读(194) 评论(0)  编辑  收藏 所属分类: hibernate

只有注册用户登录后才能发表评论。


网站导航: