Announcement Announcement Module
Collapse
No announcement yet.
How to write Native SQL Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to write Native SQL

    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)
Working...
X