---
title: "hibernate--排序"
author: "shenghw"
date: "2014-10-13T10:13:59Z"
tags: []
categories: ["开源软件"]
slug: "hibernate"
draft: false
lastmod: "2014-10-13T10:13:59Z"
id: 2128889
url: "https://wuning.iteye.com/blog/2128889"
---

实现类：HashSet无序，TreeSet,LinkedHasSet有序


配置文件中排序的配置


<!-- addressSet属性，Set集合 
			table属性：集合表的名称
			key子元素：集合外键的列名
			element子元素：存放集合元素的列的信息
			sort属性："unsorted|natural|comparatorClass"
				默认为：unsorted
			order-by属性：写的是order by 子句，是SQL语句，是操作的集合表。
				这是在查询数据时指定orderby子句。
		-->
<set name="addressSet" table="user_addressSet" order-by="address ASC">
		<key column="userId"></key>
		<element type="string" column="address"></element>
</set>