|
First of all, there are some test included in the ZIP which I don't know if these are even valid, but the outcome is not what I expected.
I would expect the following to work but the resulting SQL query only contains 2 parameters instead of 4(2 for each row value).
em.createQuery("SELECT p.id FROM Person p WHERE (p.address.street, p.address.city, p.address.postalCode) IN :addresses")
.setParameter("addresses", Arrays.asList(new Object[]{"b", "b", "b"}, new Object[]{"c", "c", "c"}))
.getResultList();
For the next query the H2Dialect seems to generate invalid SQL because H2 does not seem to support returning multiple rows from a subquery.
SELECT p.id
FROM Person p
WHERE (p.address.street, p.address.city, p.address.postalCode) IN (
SELECT address.street, address.city, address.postalCode
FROM Person p2
LEFT JOIN p2.alternativeAddresses address
WHERE p2.id <> p.id
)
And the last query is very strange too, because the generated subquery contains a select to the Id of the embeddable.
SELECT p.id
FROM Person p
WHERE p.address IN (
SELECT address
FROM Person p2
LEFT JOIN p2.alternativeAddresses address
WHERE p2.id <> p.id
)
I would expect the last two queries to behave the same way.
|