Restrictions.isEmpty ignores where clause defined in the one-to-many collection mapping

Description

In hbm.xml file:

<bag
name="issueContextRelationships"
lazy="true"
inverse="true"
cascade="all-delete-orphan"
where="SOURCE_SCREEN_NAME='Issue'"
>

<key
column="ID_XXX"
>
</key>

<one-to-many
class="com.complianceandrisks.c2p.model.compliancehierarchy.IssueContextRelationship"
/>

</bag>

Using the criteria:

criteria.add(Restrictions.isEmpty("issueContextRelationships"));

Generates the query:

where not exists (select 1 from CONTEXT_REFERENCE_RELS where this_.ID_XXX=ID_XXX)

but the

SOURCE_SCREEN_NAME='Issue' is not generated!

Environment

3.1.2 against MySQL 5.0 and Oracle 9i

Attachments

Assignee

Unassigned

Reporter

VladimirV

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure