Reputation: 319
Query is:
select e from Customer
join e.Address ad where ad.Id =:Id and :houseNo in (ad.houseNos);
I am setting all parameters in query properly, but I am getting syntax error exception.
So, my question is can we pass the houseNo
as an input parameter?
Query will select the address of customer and his house should be one of houses of that street address.
Data Model:-- Customer is main table that has a list of Address and in turn Address has a list of house no. I have address id and house no. So, I need to get customer details who is living in specified house no of specified address.
Upvotes: 0
Views: 410
Reputation: 319
After doing some more research, I found out this is not possible. We can handle asked scenario using nested query.
Upvotes: 0
Reputation: 1411
I think you got three things wrong:
IN
seems to be used in the opposite way (it must be attribute in (values)
and you're trying values in (attribute)
Try this:
select e from Customer as e
join e.address as ad // I assume address is your attribute and is declared as address (not Address), so it starts with lowercase
where ad.id = :Id and ad.houseNos in (:houseNo);
Hope it helps.
Upvotes: 1