Hibernate generates wrong parenthesis in EXISTS subquery

Description

Query

1 select count(generatedAlias0) from ci as generatedAlias0 where exists (select generatedAlias1 from property as generatedAlias1 where ( generatedAlias0.id=generatedAlias1.ciId ) and ( generatedAlias1.className=:param0 ) and ( generatedAlias1.name=:param1 ) and ( generatedAlias1.value like :param2 ))

generates

1 select count(cientity0_.ci_id) as col_0_0_ from ci cientity0_ where exists (select (ciproperty1_.ci_id, ciproperty1_.class_name, ciproperty1_.name) from property ciproperty1_ where cientity0_.ci_id=ciproperty1_.ci_id and ciproperty1_.class_name=? and ciproperty1_.name=? and (ciproperty1_.value like ?))

which fails with Error Code: 1241. Operand should contain 1 column(s)
If I remove parenthesis in "select (ciproperty1_.ci_id, ciproperty1_.class_name, ciproperty1_.name) from..." then it works.

Environment

percona-server-server-5.6 5.6.27-75.0-1.jessie amd64

Status

Assignee

Unassigned

Reporter

Oleg Poleshuk

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

4.3.11
5.1.0

Priority

Major
Configure