日期:2014-05-16  浏览次数:20369 次

hibernate set集合配置 many-to-many

1.user.hbm.xml

<set name="stationSet" table="T_USER_STATION" inverse="true" cascade="all" lazy="true">
			<key column="I_USER_ID" />
			<many-to-many column="I_STATION_ID" class="Station" />
		</set>

?2.station.hbm.xml

<set name="userSet" table="T_USER_STATION" inverse="true" cascade="all" lazy="true">
			<key column="I_STATION_ID" />
			<many-to-many column="I_USER_ID" class="User" />
		</set>
?