Tags: hibernate hql inner join left right Category: SQL Original address: Http://m33707.iteye.com/blog/829725Select from <要查询的字段> [Outer] The join on the left join returns all rows in "left_table" although there is no matching data in "right_table". Right join returns all rows in "right_table" although there is no matching data in "left_table". The result set returned by the INNER join is all matching data in two tables. Fetch: When we query the parent object, the default is only the contents of the parent, does not contain childs information, if the Parent.hbm.xml set lazy= "false" in the same time to remove all the associated childs content. The problem is that I want to hibernate both the default performance and the temporary flexibility. This is the function of fetch. We can compare the relationship between fetch and lazy= "true" to the programmatic transaction and declarative transaction in the transaction, but that is probably the meaning. Query q = Session.createquery ("From parent as parent" + "LEFT OUTER join fetch Parent.childs" + "where parent.id =: id"); In short, fetch is at the level of code to give you an initiative to seize the opportunity. You can get rid of the fetch by lazy= "true", and it will be reported as abnormal. Of course, if lazy= "false", you don't need a fetch.
Hibernate, left JOIN, inner join, and left JOIN fetch difference (GO)