log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main " org.hibernate.MappingException: entity class not found: Temp_person
at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:99)
at org.hibernate.tuple.PropertyFactory.getGetter(PropertyFactory.java:166)
at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:44)
at org.hibernate.tuple.EntityMetamodel. <init> (EntityMetamodel.java:115)
at org.hibernate.persister.entity.AbstractEntityPersister. <init> (AbstractEntityPersister.java:412)
at org.hibernate.persister.entity.SingleTableEntityPersister. <init> (SingleTableEntityPersister.java:108)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl. <init> (SessionFactoryImpl.java:216)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
at com.cx.hibenate.PersonOperate. <init> (PersonOperate.java:23)
at com.cx.hibenate.TestTemp_person.main(TestTemp_person.java:16)
Caused by: java.lang.ClassNotFoundException: Temp_person
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:108)
at org.hibernate.mapping.PersistentClass.getMappedClass(PersistentClass.java:96)
... 10 more
Temp_person.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 - Hibernate Tools
-->
<hibernate-mapping>
<class name= "Temp_person " table= "TEMP_PERSON " schema= "EDU ">
<id name= "id " type= "string ">
<column name= "ID " length= "32 " />
<generator class= "assigned "> </generator>
</id>
<property name= "name " type= "string ">
<column name= "NAME " length= "20 " not-null= "true " />
</property>
<property name= "password " type= "string ">
<column name= "PASSWORD " length= "20 " not-null= "true " />
</property>
<property name= "sex " type= "string ">
<column name= "SEX " length= "2 " />