'How to insert a data from one table to another using spring data JPA?

How to insert a data from one table to another using spring data JPA. I have query like like this

Insert into stack_tbl ( name , app_timestamp) 
Select b.areaname as name, SYSTIMESTAMP as app_timestamp 
From stack_main b
left join stack_tbl c
on c.name = b.areaname
where b.areaname IS NOT Null
AND c.name IS NULL
AND b.open = 'Yes'
GROUP BY b.areaname
ORDER BY b.areaname ASC

How can use spring data JPA to write this query in effective way. I am very much new in spring data JPA. Is there way we can do so. Thankyou if someone can guide me in write the JPA code for this



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source