Hibernate之多表查询
来源:互联网 发布:迷雾 电视剧 知乎 编辑:程序博客网 时间:2024/05/29 19:00
原生SQL多表查询
1.交叉连接(笛卡尔积)
select * from A, B
2.内连接
(1)隐式内连接
select * from A, B where b.aid = a.id
(2)显示内连接
select * from A inner join B on b.aid = a.id
3.外链接
(1)左外连接
select * from A left [outer] join B on b.aid = a.id
(2)右外连接
select * from A right [outer] join B on b.aid = a.id
HQL多表查询
1.内连接(迫切)
from Customer c inner join c.linkMans
from Customer c inner join fetch c.linkMans
2.外链接
(1)左外连接(迫切)
from Customer c left join fetch c.linkMans
(2)右外连接(迫切)
from Customer c right join fetch c.linkMans
1.交叉连接(笛卡尔积)
select * from A, B
2.内连接
(1)隐式内连接
select * from A, B where b.aid = a.id
(2)显示内连接
select * from A inner join B on b.aid = a.id
3.外链接
(1)左外连接
select * from A left [outer] join B on b.aid = a.id
(2)右外连接
select * from A right [outer] join B on b.aid = a.id
HQL多表查询
1.内连接(迫切)
from Customer c inner join c.linkMans
from Customer c inner join fetch c.linkMans
2.外链接
(1)左外连接(迫切)
from Customer c left join fetch c.linkMans
(2)右外连接(迫切)
from Customer c right join fetch c.linkMans
阅读全文
0 0
- Hibernate之多表查询
- Hibernate学习之多表查询
- Hibernate Criteria查询之多表连接分页-1
- Hibernate Criteria查询之多表连接分页-2【分页封装】
- Hibernate Criteria查询之多表连接分页-下载连接
- Oracle之多表查询
- Oracle之多表查询
- 数据库之多表查询
- MySql之多表查询
- mybatis之多表查询
- Oracle之多表查询
- SQL之多表查询
- Oracle之多表查询
- mySQL之多表查询
- oracle之多表查询
- MyBatis之多表查询
- oracle之多表查询
- Hibernate模糊查询之多条件任意组合查询
- bzoj 3943: [Usaco2015 Feb]SuperBull 最大生成树
- Python-learning Day04
- 查找文件的类 struct _finddata_t结构体用法
- POJ 1236 Network of Schools(tarjan缩点)
- oracle sequences 时间加序列的主键怎样取?
- Hibernate之多表查询
- c#命名
- assets与raw
- 腾讯云首推私有云存储,意欲抢占更多用户市场
- 解决聊天页面输入法和表情面板切换界面闪动问题
- oracle buffer cache
- PAT_1088. Rational Arithmetic
- 【Android】DELETE_FAILED_INTERNAL_ERROR Error while Installing APKs
- Java面试题下