Reputation: 3
select sm.*
from system_mail sm
left join (SELECT u.mail_code
from user_mail u
where u.to_user = 1 ) um
on sm.mail_id = um.mail_code
where um.id is null.
this SQL was running well in mysql but wrong in SpringData JPA,how can i use it in springdata jpa?
Upvotes: 0
Views: 302
Reputation: 3758
You should try to force using the DB Engine to run your SQL with nativeQuery = true
:
@Query(nativeQuery = true, value="...yourqueryhere...")
Upvotes: 1