如何在JPA左连接中的右表上应用子句

时间:2018-05-30 12:30:49

标签: jpa spring-data-jpa

我有2个表,即User和UserWallet现在我想在JPA中创建关于sql查询的查询: -

working SQL query:-
SELECT * FROM user u left join user_wallet uw on u.id=uw.user_id and uw.wallet_type=2 where u.id = 2;

JPA查询: -

not working:-
select w.address as walletAddress,u.id as id from User u left join u.userWallets w  w.walletType=2 where u.id=:id

0 个答案:

没有答案