具有条件构建器和条件查询的sql查询

时间:2020-02-12 17:28:14

标签: java hibernate jpa

我正在新学习使用休眠条件构建器和条件查询编写查询的方法,并且真的想在下面翻译查询:

从member_profile mp,transaction_cooperative tc中选择不同的mp.id,mp.username,mp.first_name,mp.last_name,mp.email_address 其中tc.cooperative_id = mp.cooperative_id 和mp.cooperative_id = 2并(从transaction_cooperative中选择sum(amount_in_and_out),其中operative_id = 2且mp.id = member_profile_id)> 0

我有三个表,即合作社,member_profile和transaction_cooperative,合作社存储系统中的所有合作社,member_profile存储合作社成员,而transaction_cooperative存储会员的借方和借方交易,所以这里的问题是我要获取合作社的所有成员余额大于零,上面的查询就是我在sql中写的,它给了我想要的结果,现在我的问题是使用hibernate编写它。

0 个答案:

没有答案
相关问题