日期:2014-05-20 浏览次数:20838 次
<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Mapping file autogenerated by MyEclipse - Hibernate Tools --> <hibernate-mapping> <class lazy="false" name="com.autonavi.monitor.model.User" table="user"> <id name="userId" type="integer" unsaved-value="0"> <column name="userId"/> <generator class="native"/> </id> <property name="name" type="string"> <column name="name" /> </property> <property name="userName" type="string"> <column name="userName" not-null="true"/> </property> <property name="password" type="string"> <column name="password" not-null="true"/> </property> <property name="actor" type="int"> <column name="actor"/> </property> <property name="authority" type="string"> <column name="authority"/> </property> <property name="email" type="string"> <column name="email"/> </property> <property name="phone" type="string"> <column name="phone"/> </property> <property name="phone1" type="string"> <column name="phone1"/> </property> <property name="phone2" type="string"> <column name="phone2"/> </property> <set name="channels" cascade="all" lazy="false"> <key column="userId" /> <one-to-many class="com.autonavi.monitor.model.Channel"/> </set> </class> </hibernate-mapping>
<?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Mapping file autogenerated by MyEclipse - Hibernate Tools --> <hibernate-mapping> <class lazy="false" name="com.autonavi.monitor.model.Channel" table="channel"> <id name="channelId" type="integer" unsaved-value="0"> <column name="channelId"/> <generator class="native"/> </id> <property name="channel" type="string"> <column name="channel" /> </property> <property name="channelName" type="string"> <column name="channel_name"/> </property> <property name="delayTime" type="integer"> <column name="delay_time" not-null="true"/> </property> </class> </hibernate-mapping>
List<Channel> userChannelList = new ArrayList<Channel>(); Channel channel = null; Set<Channel> channelSet = modifyUser.getChannels(); Iterator<Channel> iterator = channelSet.iterator(); while(iterator.hasNext()) { channel = (Channel)iterator.next(); userChannelList.add(channel); }