|
Subqueries like this throw SQLGrammarException: SELECT e1 FROM Entity1 e1 WHERE e1 IN (SELECT se1 FROM Entity1 se1 ...) when Entity1 has a compound primary key.
Caused by: java.sql.SQLSyntaxErrorException: ORA-00920: operador relacional no válido at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:445) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396) at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879) at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:450)
The SQL generated: select entity1x0_.field1 as field1_1_, entity1x0_.field2 as field2_1_, entity1x0_.data as data3_1_ from Entity1 entity1x0_ where (entity1x0_.field1, entity1x0_.field2) in (select (entity1x1_.field1, entity1x1_.field2) from Entity1 entity1x1_ where entity1x1_.data='qqq')
The problem is that fields in subquery are surrounded by brackets, and Oracle does not understand this:
select (entity1x1_.field1, entity1x1_.field2) from Entity1 entity1x1_ where entity1x1_.data='qqq' ORA-00907: missing right parenthesis
And the query without brackets works fine: select entity1x0_.field1 as field1_1_, entity1x0_.field2 as field2_1_, entity1x0_.data as data3_1_ from Entity1 entity1x0_ where (entity1x0_.field1, entity1x0_.field2) in (select entity1x1_.field1, entity1x1_.field2 from Entity1 entity1x1_ where entity1x1_.data='qqq')
|