---
title: "FetchMode的三种模式"
author: "ork"
date: "2010-09-09T17:05:37Z"
tags: []
categories: ["企业架构"]
slug: "fetchmode"
draft: false
lastmod: "2010-09-09T17:05:37Z"
id: 759642
url: "https://ork.iteye.com/blog/759642"
---

@Fetch(FetchMode.JOIN) 会使用left join查询  只产生一条sql语句  
@Fetch(FetchMode.SELECT)   会产生N+1条sql语句  
@Fetch(FetchMode.SUBSELECT)  产生两条sql语句 第二条语句使用id in (.....)查询出所有关联的数据