当前位置: 代码迷 >> Java Web开发 >> Caused by: org.hibernate.MappingException: Association references un地图ped class: com.elone.pm.product.dao.TAttribute
  详细解决方案

Caused by: org.hibernate.MappingException: Association references un地图ped class: com.elone.pm.product.dao.TAttribute

热度:6148   发布时间:2013-02-25 21:10:54
Caused by: org.hibernate.MappingException: Association references unmapped class: com.elone.pm.product.dao.TAttribute
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [com/elone/pm/applicationContext.xml]: 

Invocation of init method failed; nested exception is org.hibernate.MappingException: Association references unmapped class: com.elone.pm.product.dao.TAttribute
Caused by: org.hibernate.MappingException: Association references unmapped class: com.elone.pm.product.dao.TAttribute
at org.hibernate.cfg.HbmBinder.bindCollectionSecondPass(HbmBinder.java:2370)
at org.hibernate.cfg.HbmBinder$CollectionSecondPass.secondPass(HbmBinder.java:2652)
at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:43)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1127)

=============================================
applicationContext.xml

<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:/com/elone/pm/hibernate.cfg.xml</value>
</property>
</bean>
<bean id="attributeDAO" class="com.elone.pm.product.dao.hibernate.TAttributeDAOImpl">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
=================================
hibernate.cfg.xml
<mapping
resource="com/elone/pm/product/pojo/TAttribute.hbm.xml" />
==========================================================
TAttribute.hbm.xml

<hibernate-mapping>
  <class name="com.elone.pm.product.pojo.TAttribute" table="T_ATTRIBUTE" schema="ELPLAT">
  <id name="typeid" type="java.lang.String">
  <column name="TYPEID" length="32" />
  <generator class="uuid.hex" />
  </id>
  <many-to-one name="protype" lazy="false" class="com.elone.pm.product.pojo.TProtype" fetch="select">
  <column name="PROCLASSID" length="32" />
  </many-to-one>
  <many-to-one name="parent" lazy="false" class="com.elone.pm.product.pojo.TAttribute" fetch="select">
  <column name="PARENTID" length="32" />
  </many-to-one> 
  <property name="attname" type="java.lang.String">
  <column name="ATTNAME" length="50" />
  </property>
  <property name="attorder" type="java.lang.String">
  <column name="ATTORDER" length="50" />
  </property>
  <property name="attstyle" type="java.lang.String">
  <column name="ATTSTYLE" length="50" />
  </property>
  <property name="attsign" type="java.lang.String">
  <column name="ATTSIGN" length="50" />
  </property>
  <set name="childrens" lazy="false" inverse="true">
  <key>
  <column name="PARENTID" length="32" />
  </key>
  <one-to-many class="com.elone.pm.product.pojo.TAttribute" />
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!