We're updating the issue view to help you get more done. 

Where clauses mapped on collections and entities need parentheses when used in conjunction

Description

Given the following mapping:

1 2 3 4 5 6 7 8 9 10 11 12 13 @Entity public class Team { ... @OneToMany @Where( level = 'expert' or level = 'high' ) private Set<Player> expertAndHighLevelPlayers; } @Entity @Where( active = 1 ) public class Player .... private String level;

Currently, the query for loading Team#expertAndHighLevelPlayers would be something like:

1 active = 1 and level = 'expert' or level = 'high'

Parentheses should be added to ensure that the separate clauses have the proper precedence, as in:

1 ( active = 1 ) and ( level = 'expert' or level = 'high' )

.

This affects hbm.xml mappings as well.

Environment

None

Status

Assignee

Gail Badner

Reporter

Gail Badner

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.17
5.1.15
5.3.4

Priority

Major