我一直在尝试修复此错误。每次我添加HistoryLog.hbm.xml时,我都会在下面看到Duplicate错误。
Mar 11, 2016 4:51:54 PM org.hibernate.cfg.Configuration$MappingsImpl addImport
INFO: HHH000071: Duplicate import: persistent.Account -> persistent.Account
Mar 11, 2016 4:51:54 PM org.hibernate.cfg.Configuration$MappingsImpl addImport
INFO: HHH000071: Duplicate import: persistent.Account -> Account
但我找不到它为什么会一直发生的原因。我已经发布了下面的xmls
的hibernate.cfg.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="hbm2ddl.auto">update</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/bank_system
</property>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="connection.username">root</property>
<property name="connection.password">12345</property>
<property name="dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="show_sql">true</property>
<mapping resource="Account.hbm.xml" />
<mapping resource="User.hbm.xml" />
<mapping resource="TransactionalLog.hbm.xml" />
<mapping resource="RequestTransferLog.hbm.xml" />
<mapping resource="HistoryLog.hbm.xml" />
</session-factory>
</hibernate-configuration>
HistoryLog.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">
<hibernate-mapping>
<class name="persistent.HistoryLog" table="account_history_log">
<id name="historyLogCounter" type="long" column="history_log_counter">
<generator class="identity"></generator>
</id>
<property name="accountID" column="account_id" type="long"/>
<property name="userId" column="user_id" type="long"/>
<property name="officerID" column="officer_id" type="long"/>
<property name="dateTime" column="date_time" type="java.util.Date"/>
<property name="actionDone" column="action_done" type="string"/>
<property name="remarks" column="remarks" type="string"/>
</class>
</hibernate-mapping>
Account.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">
<hibernate-mapping>
<class name="persistent.Account" table="account">
<id name="accountId" type="long" column="account_id">
<generator class="assigned"></generator>
</id>
<property name="balance" column="balance" type="float"/>
<property name="userId" column="user_id" type="long"/>
</class>
</hibernate-mapping>
编辑:添加了我的发现* .xml
./src/hibernate.cfg.xml
./src/User.hbm.xml
./src/Account.hbm.xml
./src/HistoryLog.hbm.xml
./src/TransactionalLog.hbm.xml
./src/RequestTransferLog.hbm.xml
./WebRoot/WEB-INF/web.xml
./WebRoot/WEB-INF/classes/hibernate.cfg.xml
./WebRoot/WEB-INF/classes/User.hbm.xml
./WebRoot/WEB-INF/classes/Account.hbm.xml
./WebRoot/WEB-INF/classes/HistoryLog.hbm.xml
./WebRoot/WEB-INF/classes/TransactionalLog.hbm.xml
./WebRoot/WEB-INF/classes/RequestTransferLog.hbm.xml
./.settings/org.eclipse.wst.common.project.facet.core.xml