<?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="connection.username">root</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/test
</property>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="myeclipse.connection.profile">MySQL</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="show_sql">true</property>
<mapping resource="com/jopo/person.xml" /></session-factory></hibernate-configuration><?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="dao" class="com.dao.Dao">
<property name="hibernateTemplate" ref="template"></property>
</bean>

<bean id="template" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessonFactory"></property>
</bean>

<bean id="sessonFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>
</beans>
错误信息:
Exception in thread "main" org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: java.lang.String; nested exception is org.hibernate.MappingException: Unknown entity: java.lang.String
我找了很久都没找出来``````确实找不到了``知道的给我说下谢谢

解决方案 »

  1.   

    <property name="connection.url">
            jdbc:mysql://localhost:3306/test
        </property>把中间的空格去掉,改为<property name="connection.url">jdbc:mysql://localhost:3306/test</property>
      

  2.   

    com/jopo/person.xml这个文件你有吗?
      

  3.   

    有啊`!我现在搞起了不过直接调用要出问题```自己写一个BO间接调用就没问题````直接调用Dao不会出错`但是插不进数据库!间接调用就么问题!
      

  4.   

    怀疑你的configLocation配置有问题,好好查查。