CstService.hbm.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">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="com.crm.entity.CstService" table="cst_service" schema="dbo" catalog="jb_crm_team0">
<id name="svrId" type="java.lang.Long">
<column name="svr_id" />
<generator class="identity" />
</id>
<many-to-one name="cstCustomer" class="com.crm.entity.CstCustomer" fetch="select">
<column name="svr_cust_no" length="17" />
</many-to-one>
<many-to-one name="sysUser" class="com.crm.entity.SysUser" fetch="select">
<column name="svr_create_id" not-null="true" />
</many-to-one>
<property name="svrType" type="java.lang.String">
<column name="svr_type" length="20" not-null="true" />
</property>
<property name="svrTitle" type="java.lang.String">
<column name="svr_title" length="500" not-null="true" />
</property>
<property name="svrCustName" type="java.lang.String">
<column name="svr_cust_name" length="100" not-null="true" />
</property>
<property name="svrStatus" type="java.lang.String">
<column name="svr_status" length="10" not-null="true" />
</property>
<property name="svrRequest" type="java.lang.String">
<column name="svr_request" length="3000" not-null="true" />
</property>
<property name="svrCreateBy" type="java.lang.String">
<column name="svr_create_by" length="50" not-null="true" />
</property>
<property name="svrCreateDate" type="java.util.Date">
<column name="svr_create_date" length="23" not-null="true" />
</property>
<property name="svrDueId" type="java.lang.Long">
<column name="svr_due_id" />
</property>
<property name="svrDueTo" type="java.lang.String">
<column name="svr_due_to" length="50" />
</property>
<property name="svrDueDate" type="java.util.Date">
<column name="svr_due_date" length="23" />
</property>
<property name="svrDeal" type="java.lang.String">
<column name="svr_deal" length="3000" />
</property>
<property name="svrDealId" type="java.lang.Long">
<column name="svr_deal_id" />
</property>
<property name="svrDealBy" type="java.lang.String">
<column name="svr_deal_by" length="50" />
</property>
<property name="svrDealDate" type="java.util.Date">
<column name="svr_deal_date" length="23" />
</property>
<property name="svrResult" type="java.lang.String">
<column name="svr_result" length="500" />
</property>
<property name="svrSatisfy" type="java.lang.Integer">
<column name="svr_satisfy" />
</property>
</class>
</hibernate-mapping>
hibernate.cfg.xml的代码如下:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
" http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password">xiaotingzi</property>
<property name="hibernate.connection.url">
jdbc:sqlserver://localhost\\sqlexpress:8888;databaseName=jb_crm_team0_Data
</property>
<property name="dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<property name="myeclipse.connection.profile">crmDriver</property>
<property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="show_sql">true</property>
<mapping resource="com/crm/entity/SysUser.hbm.xml"/>
<mapping resource="com/crm/entity/SysRole.hbm.xml"/>
<mapping resource="com/crm/entity/CstActivity.hbm.xml"/>
<mapping resource="com/crm/entity/CstService.hbm.xml"/>
<mapping resource="com/crm/entity/CstLinkman.hbm.xml"/>
<mapping resource="com/crm/entity/CstCustomer.hbm.xml"/>
<mapping resource="com/crm/entity/SalChance.hbm.xml"/>
<mapping resource="com/crm/entity/SysRoleRight.hbm.xml"/>
</session-factory>
</hibernate-configuration>
测试类的代码如下:
package com.crm.test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.crm.entity.SysUser;
import com.crm.inf.SysUserDAO;
public class Test {
public static void main(String[] orgs){
ApplicationContext act=new ClassPathXmlApplicationContext("applicationContext.xml");
}
}
异常如下:
Caused by: org.hibernate.MappingException: Association references unmapped class: CstService
请高手指点迷津