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

Activity

Show:
VladimirV
July 10, 2007, 3:29 AM

We want to come up with a fix for this problem. Can someone from the Hibernate team point us to the right place in the Hibernate code?

TsuyoshiT
July 20, 2007, 5:19 AM

Dear Hiernate developers,

I am a developer working for Vladimir above and tried to fix this bug a few days ago.
I will attach patch files created by WinMerge.
As you see I made an additional access method on OneToManyPersister.java that can be a 'hack' and a propery way should may exists through existing methods but I did not look into details... So if you could check this point then it would become safer although I can not see any situations that may give a wrong String for this case.

Best Regards,
Tsuyoshi
7.19.2007.

Brett Meyer
December 17, 2013, 7:00 PM

If this is still an issue on ORM 4.2 or 4.3, anyone have a test case to attach?

Brett Meyer
December 19, 2013, 10:31 PM

Note: In an attempt to clean up the HHH JIRA, we will be rejecting any ticket that sits in the "Awaiting Test Case" state for 2-3 months with no response. So, if this issue is critical to you, please attach a reproducing test case ASAP. Thanks!

Brett Meyer
March 3, 2014, 3:40 PM

Bulk rejecting issues lacking a test case or recent response.

Rejected

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