<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.gosophia.resourcePermission.entity">
<class name="ResourcePermission" table="T_RESOURCE_PERMISSION">
<id name="resourceId" type="long" column="RESOURCEID">
<generator class="sequence" />
</id>
<property name="resourceName" column="RESOURCENAME" />
<property name="resourceDescription" column="RESOURCEDESCRIPTION" />
<property name="resourceMatch" column="RESOURCEMATCH" />
<bag name="rules" inverse="true" cascade="all" order-by="ruleOrder asc">
<key>
<column name="RESOURCEID"></column>
</key>
<one-to-many class="Rule" />
</bag>
</class>
</hibernate-mapping>
这样配就可以对list排序了,这个排序时可以排列多级list
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.gosophia.resourcePermission.entity">
<class name="ResourcePermission" table="T_RESOURCE_PERMISSION">
<id name="resourceId" type="long" column="RESOURCEID">
<generator class="sequence" />
</id>
<property name="resourceName" column="RESOURCENAME" />
<property name="resourceDescription" column="RESOURCEDESCRIPTION" />
<property name="resourceMatch" column="RESOURCEMATCH" />
<bag name="rules" inverse="true" cascade="all" order-by="ruleOrder asc">
<key>
<column name="RESOURCEID"></column>
</key>
<one-to-many class="Rule" />
</bag>
</class>
</hibernate-mapping>
这样配就可以对list排序了,这个排序时可以排列多级list
本文详细介绍了使用Hibernate进行实体映射的方法,特别是针对资源权限实体的配置案例,展示了如何通过XML定义实体类及其属性,包括ID生成策略、属性映射及一对多关系的配置,并实现对关联集合的排序。
1292

被折叠的 条评论
为什么被折叠?



