2

我使用docRelatedUseMap地图将文档相关用户存储在休眠映射中。我想从中获取特定的用户文档。

<hibernate-mapping >
<class name="com.v4common.shared.beans.domain.common.transaction.Document" table="document">
 <id name="id" column="id" type="long">
 <generator class="native"/>
 </id>
 <property column="document_name" name="documentName"/>
 <property column="reference_number" name="referenceNumber"/>
 <property column="description" name="shortDescription"/>
 <property column="long_description" name="longDescription"/>
 <property column="status" name="documentStatus"/>
 <property column="open_authority_id" name="openAuthority"/>
 <property column="tender_no" name="tenderNo" type="long"/>
 <property column="offer_no" name="offerNo" type="long"/>
 <map name="docRelatedUserMap" cascade="refresh" table="doc_related_user_map">
 <key column="document_id"/>
 <map-key  column="user_id" type ="long"/>
 <element column="last_modified_date"  type="timestamp" not-null="true"/>
 </map>
 </class>
</hibernate-mapping>

在标准中:

Criteria criteria = session.createCriteria(Document.class);
criteria.setResultTransformer(criteria.DISTINCT_ROOT_ENTITY);
//need to write line code here
List<Document> innerDocList=criteria.list();

如何在休眠中使用条件?

4

0 回答 0