Hi,
I am using spring data JPA for database access, I need to write complex query inorder to get data from DB, so i decided to go with pure SQL. Is it possible to write using spring data JPA? if that so is there any guide or example?
My query is:
select d from ad d
inner join prod_ad pad
ON d.ad_id=pad.ad_id inner join product a on pad.product_id=a.product_id
where a.brand_id in (
select ib.brand_id from SUBSCRIBED_CHANNEL ia
inner join product ib
where ia.channel_id=ib.product_id and ia.user_id=: productID)
and a.product_id not in (
select ib.product_id from SUBSCRIBED_CHANNEL ia
inner join product ib where ia.channel_id=ib.product_id and ia.user_id=: productID)
I am using spring data JPA for database access, I need to write complex query inorder to get data from DB, so i decided to go with pure SQL. Is it possible to write using spring data JPA? if that so is there any guide or example?
My query is:
select d from ad d
inner join prod_ad pad
ON d.ad_id=pad.ad_id inner join product a on pad.product_id=a.product_id
where a.brand_id in (
select ib.brand_id from SUBSCRIBED_CHANNEL ia
inner join product ib
where ia.channel_id=ib.product_id and ia.user_id=: productID)
and a.product_id not in (
select ib.product_id from SUBSCRIBED_CHANNEL ia
inner join product ib where ia.channel_id=ib.product_id and ia.user_id=: productID)