急求助:org.hibernate.MappingException: Unknown entity:

xu101q 2010-12-16 01:32:37
异常错误如:org.hibernate.MappingException: Unknown entity: com.xdtech.platform.domain.model.user.xkq


求高手帮忙解决,。。是不是还有什么地方没有配置到哦!!!
我 的applicationContext.xml配置文件如下
<?xml version="1.0" encoding="GBK"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
default-autowire="byName" default-lazy-init="false">
<import resource="classpath:org/codehaus/xfire/spring/xfire.xml"/>
<!-- 获得applicationContext中所有bean的JSR181 annotation -->
<bean id="webAnnotations" class="org.codehaus.xfire.annotations.jsr181.Jsr181WebAnnotations" lazy-init="false"/>
<!-- 定义handler mapping,将所有JSR181定义的bean导出为web service -->
<bean id="jsr181HandlerMapping" class="org.codehaus.xfire.spring.remoting.Jsr181HandlerMapping" lazy-init="false">
<property name="xfire" ref="xfire"/>
<property name="webAnnotations" ref="webAnnotations"/>
</bean>
<bean class="com.xdtech.platform.core.service.SearchService" />
<bean class="com.xdtech.platform.core.service.IndexDelete" />

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<!-- MY SQL DATABACE CONNECTION-->

<property name="driverClass" value="com.mysql.jdbc.Driver" />

<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/cis?useUnicode=true&characterEncoding=UTF-8" />

<property name="user" value="root" />
<property name="password" value="123" />
<property name="maxIdleTime"><value>1800</value></property>
<property name="acquireIncrement"><value>2</value></property>
<property name="maxStatements"><value>0</value></property>
<property name="initialPoolSize"><value>2</value></property>
<property name="idleConnectionTestPeriod"><value>1800</value></property>
<property name="acquireRetryAttempts"><value>30</value></property>
<property name="testConnectionOnCheckout"><value>false</value></property>

</bean>
<!-- bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource"><ref bean="dataSource" /></property>
<property name="hibernateProperties">
<map>
<entry key="hibernate.connection.isolation" value="4"/>
<entry key="hibernate.max_fetch_depth" value="1"/>
<entry key="hibernate.show_sql" value="false"/>
<!-- 请注意修改相应的数据库方言 -->
<entry key="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<entry key="hibernate.cache.use_query_cache" value="false"/>
<entry key="hibernate.query.substitutions" value="true 1, false 0, yes 'Y', no 'N'"/>
<entry key="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>
<entry key="hibernate.query.factory_class" value="org.hibernate.hql.ast.ASTQueryTranslatorFactory"/>
</map>
</property>
<property name="annotatedClasses">
<list>
<value>com.xdtech.platform.domain.model.user.User</value>
<value>com.xdtech.platform.domain.model.user.UserInfGroup</value>
<value>com.xdtech.platform.domain.model.user.xkq</value>

</list>
</property>
</bean>



<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>

<bean id="transactionInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="delete*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="add*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="update*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="save*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
<prop key="edit*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="reload*">PROPAGATION_REQUIRED,-Exception</prop>
<prop key="*">PROPAGATION_SUPPORTS</prop>
</props>
</property>
</bean>

<bean
class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator" >
<property name="beanNames">
<list>
<value>com.xdtech.platform.web.actions*</value>
</list>
</property>
<property name="interceptorNames">
<list>
<value>transactionInterceptor</value>
</list>
</property>
<property name="proxyTargetClass" value="true"/>

</bean>
<!-- -->
<bean id="dao" class="com.xdtech.platform.dao.IDaoManager" />



<bean id="initbean"
class="com.xdtech.platform.util.server.SpringInitBean"
scope="singleton"
init-method="init">
<property name="port">
<value>8011</value>
</property>
</bean>

</beans>

...全文
542 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
leijuanjuan 2012-07-22
  • 打赏
  • 举报
回复
楼主,是什么问题,我也报这个错????
xu101q 2010-12-16
  • 打赏
  • 举报
回复
问题 自己解决了 ~~~

原来是注解问题!~~~~

xu101q 2010-12-16
  • 打赏
  • 举报
回复
注解!!!
package com.xdtech.platform.domain.model.user;

import javax.persistence.Table;
import javax.persistence.Entity;
import javax.persistence.Transient;

import com.xdtech.platform.domain.service.DomainLogic;
import javax.persistence.GeneratedValue;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.Id;
import javax.persistence.Column;
import java.util.Date;
/**
* 测试
* @author xkq
*
*/
@Entity
@Table(name = "xkq")
@org.hibernate.annotations.Proxy(lazy = true)
public class xkq extends DomainLogic {

private String sid;
private String pid;

@Id
@Column(length = 32)
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uuid")

public String getSid() {
return sid;
}
public void setSid(String sid) {
this.sid = sid;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}


}

这是 我 的com.xdtech.platform.domain.model.user.xkq文件!
zn85600301 2010-12-16
  • 打赏
  • 举报
回复
你的hibernate是注解的 还是映射文件?
zn85600301 2010-12-16
  • 打赏
  • 举报
回复
你的hibernate用的是注解 还是映射文件?
xu101q 2010-12-16
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 dyllove98 的回复:]
XML code
<property name="annotatedClasses">
<list>
<value>com.xdtech.platform.domain.model.user.User</value>
<value>com.xdtech.platform.domain.model.u……
[/Quote]

能说详细点吗?我才接触到hibernate和spring技术。。。你说的JAVAbean类映射文件是什么 ,一般放在什么地方,是XML格式的吗?

谢谢 真的很急
Jlins 2010-12-16
  • 打赏
  • 举报
回复
  <property name="annotatedClasses">
<list>
<value>com.xdtech.platform.domain.model.user.User</value>
<value>com.xdtech.platform.domain.model.user.UserInfGroup</value>
<value>com.xdtech.platform.domain.model.user.xkq</value>

</list>
</property>


这个能自动做映射吗?你加入javabean类映射的文件了吗?
ke922 2010-12-16
  • 打赏
  • 举报
回复
貌似是你没有配置com.xdtech.platform.domain.model.user.xkq的Hibernate映射文件

81,095

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧