这是dao层
ds = HibernateDataSource.getHibernateDataSource();
session = ds.getSession();
String sql1="SELECT CHANNEL_ID FROM JC_CHANNEL WHERE PARENT_ID='"+ channelId + "'";
SQLQuery sqlQuery1 = session.createSQLQuery(sql1.toString());
List<Channel> channelList = sqlQuery1.addScalar("id",Hibernate.INTEGER).setResultTransformer(Transformers.aliasToBean(Channel.class)).list();
List idList=new ArrayList();
这是配置文件中
<class name="Channel" table="jc_channel" dynamic-update="true">
<meta attribute="sync-DAO">false</meta>
<cache usage="read-write"/>
<id name="id" type="java.lang.Integer" column="channel_id">
<!-- <generator class="identity"/>-->
<generator class="sequence">
<param name="sequence">SEQ_JC_CHANNEL</param>
</generator>
</id>
<property name="path" column="channel_path" type="string" not-null="false" length="30"/>
<property name="lft" column="lft" type="integer" not-null="true" length="10"/>
<property name="rgt" column="rgt" type="integer" not-null="true" length="10"/>
<property name="priority" column="priority" type="integer" not-null="true" length="10"/>
<property name="hasContent" column="has_content" type="java.lang.Boolean" not-null="true"/>
<property name="display" column="is_display" type="java.lang.Boolean" not-null="true"/>
<one-to-one name="channelExt" class="ChannelExt" cascade="delete"/>
<many-to-one name="site" column="site_id" class="CmsSite" not-null="true"></many-to-one>
<many-to-one name="model" column="model_id" class="CmsModel" not-null="true"></many-to-one>
<many-to-one name="parent" column="parent_id" class="Channel" not-null="false"></many-to-one>
<set name="child" inverse="true" cascade="delete" sort="com.jeecms.common.hibernate3.PriorityComparator">
<cache usage="read-write"/>
<key column="parent_id"/>
<one-to-many class="Channel"/>
</set>
<set name="viewGroups" table="jc_chnl_group_view" sort="com.jeecms.common.hibernate3.PriorityComparator">
<cache usage="read-write"/>
<key column="channel_id"/>
<many-to-many column="group_id" class="CmsGroup"/>
</set>
<set name="contriGroups" table="jc_chnl_group_contri" sort="com.jeecms.common.hibernate3.PriorityComparator">
<cache usage="read-write"/>
<key column="channel_id"/>
<many-to-many column="group_id" class="CmsGroup"/>
</set>
<set name="users" table="jc_channel_user" sort="com.jeecms.common.hibernate3.PriorityComparator">
<cache usage="read-write"/>
<key column="channel_id"/>
<many-to-many column="user_id" class="CmsUser"/>
</set>
<set name="channelTxtSet" inverse="true" cascade="delete-orphan">
<cache usage="read-write"/>
<key column="channel_id"/>
<one-to-many class="ChannelTxt"/>
</set>
<map name="attr" table="jc_channel_attr" cascade="all-delete-orphan">
<cache usage="read-write"/>
<key column="channel_id" not-null="true"/>
<map-key column="attr_name" type="string" length="30"/>
<element column="attr_value" type="string" length="255"/>
</map>
</class>