和struts结合,com.yourcompany.struts.form.UserNameForm是formbean,报org.hibernate.MappingException: Unknown entity: com.yourcompany.struts.form.UserNameForm错误,这是hbm文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class name="com.yourcompany.struts.form.UserNameForm" table="USER">
<id name="id" column="id" type="long">
<generator class="identity"></generator>
</id>
<property name="name" column="name" type="String"></property>
<property name="password" column="password" ></property>
</class>
</hibernate-mapping>
------解决方法--------------------------------------------------------
没有建立映射
你的hibernate.cfg.xml 里面有没有把映射文件加进去?