<class name="com.emolay.drm.model.DrmMenu" table="DRM_MENU">
改成
<class name="com.emolay.drm.model.DrmMenu" table="drm_menu">
就报错Caused by: org.hibernate.MappingException: Foreign key (FKE1E9F3FFC2622061:drm_menu [id])) must have same number of columns as the referenced primary key (drm_menu [pid,id])
搞不懂 搞不懂 ,命名数据库就是小写啊,但是同样改成小写,linux就可以
xml配置如下
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="com.emolay.drm.model.DrmMenu" table="DRM_MENU">
<id name="id" column="ID" type="java.lang.Integer" length="11">
<generator class="native" />
</id>
<property name="name" column="NAME" type="java.lang.String"
length="50" />
<property name="linkValue" column="LINKVALUE" type="java.lang.String"
length="50" />
<property name="indexNum" column="INDEXNUM" type="java.lang.Integer"
length="11" />
<set name="subMenus" table="drm_menu" lazy="false" sort="com.emolay.drm.util.MenuComparator">
<key column="pid"/>
<many-to-many class="com.emolay.drm.model.DrmMenu" column="id"></many-to-many>
</set>
<set name="roles" table="drm_menu_role" lazy="false">
<key column="menuId"/>
<many-to-many class="com.emolay.drm.model.DrmRole" column="roleId"></many-to-many>
</set>
</class>
</hibernate-mapping>