闂鎻愬嚭錛?/STRONG>鏈榪戦」鐩嚭鐜頒竴涓狝rticle鎸佷箙綾伙紝璇ユ寔涔呯被鎷ユ湁涓涓狢lob灞炴х敤浜庤褰曟枃绔犵殑鍐呭!紺轟緥濡備笅:

public class Article implements Serializable
{
public Long articleId;
public String author;
public String title;
public Date created;
public Clob content;

//getter
//setter
}
鍚庢潵鍙戠幇錛屽湪鏌ユ壘鏂囩珷鍒楄〃鐨勬椂鍊欙紝姣忎釜Article閮借浠庢暟鎹簱涓姞杞藉嚭content錛佷弗閲嶅獎鍝嶆晥鐜囷紒
瑙e喅鏂規1錛?/FONT>
鍦ㄧ綉涓婃壘鐩稿叧鐨勮祫鏂欙紝鍒╃敤hql鍙互瑙e喅闂:
select new Article(a.articleId,a.author,a.title,a.created) from Article as a where
璁板緱瑕佷負 Article 娣誨姞鏋勯犲嚱鏁幫紝鍍忎笂闈㈢殑hql闇瑕佹瀯閫犲嚱鏁板:

public Article(Long articleId,String author,String title,Date create)
{
this.articleId = articleId;
this.author = author;
this.title = title;
this.create = create;
}
瑙e喅鏂規2錛?/FONT>
鐒惰岃繖鏍峰瓙鍋氾紝鍒楄〃閲岄潰鐨凙rticle榪樹笉澶熻交閲忥紝浜庢槸紿佺劧鏈夊ぉ鍦℉ibernate瀹樻柟緗戠珯鎵懼嚭鏇村ソ鐨勮В鍐蟲柟娉曪紒閭e氨鏄墍璋撶殑Light Weight妯″紡錛岀ず渚嬩唬鐮佸涓嬶細

public class ArticleInfo implements Serializable
{
public Long articleId;
public String author;
public String title;
public Date created;

//getter
//setter
}

public class Article extends ArticleInfo
{
public Clob content;

//getter
//setter
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="test.ArticleInfo" table="test_article" polymorphism="explicit" >
<id name="articleId" column="article_id" type="java.lang.Long" length="30">
<generator class="sequence">
<param name="sequence">article_seq</param>
</generator>
</id>
<property name="authorId" column="author_id" type="java.lang.String" length="10" not-null="true"/>

<property name="title" column="title" type="java.lang.String" length="10" not-null="true"/>

<property name="created" column="created" type="java.util.Date" not-null="true"/>
</class>
</hibernate-mapping>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="test.Article" table="test_article" polymorphism="explicit" >
<id name="articleId" column="article_id" type="java.lang.Long" length="30">
<generator class="sequence">
<param name="sequence">article_seq</param>
</generator>
</id>
<property name="authorId" column="author_id" type="java.lang.String" length="10" not-null="true"/>

<property name="title" column="title" type="java.lang.String" length="10" not-null="true"/>

<property name="created" column="created" type="java.util.Date" not-null="true"/>

<property name="content" column="content" type="java.sql.Clob" not-null="true"/>
</class>
</hibernate-mapping>

璁板緱瑕佸姞涓?polymorphism="explicit" 琛ㄧず涓哄鎬?
榪欐牱瀛愶紝褰撴垜浠渶瑕佸姞杞藉ぇ瀵硅薄content鐨勬椂鍊欏彲浠?BR>
session.load(Article.class,articleId);
OR
String hql="select a from Article as a where...";
濡傛灉錛屼笉闇瑕佺敤鍒板ぇ瀵硅薄錛屽垯鍙互
session.load(ArticleInfo.class,articleId);
OR
String hql="select a from ArticleInfo as a where ...";
]]>