<?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.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/finance
</property>
<property name="connection.username">root</property>
<property name="connection.password">root</property>
<!-- SQL方言,这边设定的是MySQL -->
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup-->
<property name="hbm2ddl.auto">update</property>
<property name="myeclipse.connection.profile">MySqlJ</property>
<!-- 映射文件-->
<mapping resource="fin/FinEntity.hbm.xml" />
</session-factory>
</hibernate-configuration>FinEntity.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="fin.FinEntity" table="finentity" catalog="finance">
<id name="fin_id" type="java.lang.Integer">
<column name="fin_id" />
<generator class="identity" />
</id>
</class>
<property name="fin_type" type="java.lang.String">
<column name="fin_type" length="8" not-null="true" />
</property>
</hibernate-mapping>
错误信息org.hibernate.MappingException: Unknown entity: java.lang.String
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:550)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1338)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180)
<!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.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/finance
</property>
<property name="connection.username">root</property>
<property name="connection.password">root</property>
<!-- SQL方言,这边设定的是MySQL -->
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup-->
<property name="hbm2ddl.auto">update</property>
<property name="myeclipse.connection.profile">MySqlJ</property>
<!-- 映射文件-->
<mapping resource="fin/FinEntity.hbm.xml" />
</session-factory>
</hibernate-configuration>FinEntity.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="fin.FinEntity" table="finentity" catalog="finance">
<id name="fin_id" type="java.lang.Integer">
<column name="fin_id" />
<generator class="identity" />
</id>
</class>
<property name="fin_type" type="java.lang.String">
<column name="fin_type" length="8" not-null="true" />
</property>
</hibernate-mapping>
错误信息org.hibernate.MappingException: Unknown entity: java.lang.String
at org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:550)
at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1338)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180)
这里的fin_type 去掉下划线,改为
finType
<column name="player_name" length="50" />
</property>给你个例子 对着写