Hibernate一对多双向关系错,望高手详解
用户表:
<hibernate-mapping package="com.mypack">
<class name="UserInf" table="user_inf">
<meta attribute="sync-DAO">false</meta>
<id name="userId" type="integer" column="USER_ID"
unsaved-value="null">
<generator class="native" />
</id>
<property name="userNm" column="USER_NM" type="string"
not-null="false" length="32" />
<property name="userPsw" column="USER_PSW" type="string"
not-null="false" length="32" />
<property name="roleTypeCode" column="ROLE_TYPE_CODE"
type="string" not-null="false" length="2" />
<set name="prjInfs" cascade="delete" inverse="true">
<key column="CST_ID" />
<one-to-many class="PrjInf" />
</set>
</class>
</hibernate-mapping>
项目表:
hibernate-mapping package="com.mypack">
<class name="PrjPersonnelSetup" table="prj_personnel_setup">
<meta attribute="sync-DAO">false</meta>
<id name="prjPersonnelSetupId" type="integer"
column="PRJ_PERSONNEL_SETUP_ID">
<generator class="native" />
</id>
<property name="roleTypeCode" column="ROLE_TYPE_CODE"
type="string" not-null="false" length="2" />
<property name="prjVisibility" column="PRJ_VISIBILITY"
type="string" not-null="false" length="1" />
<property name="bookId" column="BOOK_ID" type="string"
not-null="false" length="1" />
<property name="prjIntegral" column="PRJ_INTEGRAL"
type="integer" not-null="false" length="11" />
<property name="prjPersonnelStat" column="PRJ_PERSONNEL_STAT"
type="string" not-null="false" length="1" />
<many-to-one name="prjInf" column="PRJ_ID" class="PrjInf"
cascade="none" not-null="false"/>
</class>
</hibernate-mapping>
读取项目表的时候出错如下:
java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
……省略……
at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
... 84 more
Caused by: java.lang.LinkageError: duplicate class definition: $java/lang/Object$$FastClassByCGLIB$$3f697993
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
... 89 more
怎么最终的CauseBy是duplicate class definition?极度郁闷中。