Mapping documents:
<class name="Filestatus" table="filestatus" >
<id name="filestatusid" type="java.lang.Integer" column="filestatusid" >
<generator class="assigned" />
</id>
<property name="expectedfileid" type="int" column="expectedfileid"
not-null="true" length="11" />
<property name="status" type="java.lang.String" column="status" length="1"
/>
<property name="actualfilename" type="java.lang.String"
column="actualfilename" length="50" />
<!-- Associations -->
</class>
<class name="Expectedfile" table="expectedfiles" >
<id name="fileid" type="java.lang.Integer" column="fileid" >
<generator class="assigned" />
</id>
<property name="mask" type="java.lang.String" column="mask" length="64" />
<property name="providermmid" type="java.lang.String" column="providermmid"
length="12" />
<!-- Associations -->
<set name="fileStatusAsSet" lazy="true" cascade="all">
<key column="expectedfileid"/>
<one-to-many class="Filestatus"/>
</set>
</class>
Query That I am using
select distinct file from com.tagaudit.itag.om.audits.Expectedfile file join file.fileStatusAsSet fileStatus where fileStatus.status = 'L'
Expected result I think
One file record and a list of fileStatus within that record which contains only fileStatus.status = 'L'
Problem
I get one file record, but the fileStatus.status is not restricted to L. I get all the records within.
I dont know what I am doing wrong. Please help !!!
Thanks,
Amit
|