2012-05-11 14 views
0

HibernateツールEclipseアドオンでHibernateコード生成機能を使用しようとしています。それは私に次のエラーを与えている:Eclipse Hibernateツールの問題

org.hibernate.InvalidMappingException:マッピング・ドキュメントを解析できませんでしたリソースからAlert.hbm.xml をマッピング・ドキュメントを解析できませんでしたリソースAlert.hbm.xml org.hibernate.MappingExceptionから:アラートID: クラスを検索中にアラートが見つかりません:alertId org.hibernate.MappingException:クラスアラートがプロパティを検索中に見つかりません:alertId クラスアラートが見つかりません:alertId java.lang.ClassNotFoundException:Alert Alert

クラスAlert.javaが見つかりませんでしたが、コードジェネレータ(したがって、名前...)が私のためにすべてのハイバネートクラスを生成すると考えられました。

eclipse IndigoをHibernate Tools 3.4.xで使用する。

は、ここに私はhibernate.cfg.xmlです:

 
<!DOCTYPE hibernate-configuration PUBLIC 
     "-//Hibernate/Hibernate Configuration DTD 3.0//EN" 
     "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> 

<hibernate-configuration> 
    <session-factory> 
     <!-- Database connection settings --> 
     <property name="connection.driver_class"> 
      com.mysql.jdbc.Driver 
     </property> 
     <property name="connection.url"> 
      jdbc:mysql://localhost:3306/findata?tcpKeepAlive=true 
     </property> 
     <property name="connection.username">root</property> 
     <property name="connection.password">madmax1.</property> 

     <property name="connection.pool_size">2</property> 
     <property name="show_sql">true</property> 
     <property name="dialect"> 
      org.hibernate.dialect.mysqldialect 
     </property> 
     <property name="current_session_context_class">thread</property> 
     <property name="cache.provider_class"> 
      org.hibernate.cache.NoCacheProvider 
     </property> 

     <mapping resource="Alert.hbm.xml" /> 
     <mapping resource="Entity.hbm.xml" /> 
     <mapping resource="FactData.hbm.xml" /> 
     <mapping resource="TimeEvent.hbm.xml" /> 
     <mapping resource="User.hbm.xml" /> 
     <mapping resource="AlertTarget.hbm.xml" /> 
     <mapping resource="LogAlert.hbm.xml" /> 
    </session-factory> 
</hibernate-configuration> 

ここAlert.hbm.xmlだ:それは-生成されるクラスを探している

 
<?xml version="1.0"?> 
<!DOCTYPE hibernate-mapping PUBLIC 
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN" 
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> 

<hibernate-mapping> 
    <class name="Alert" table="alerts"> 
     <id name="alertId" column="id"> 
      <generator class="assigned"/> 
     </id> 
     <property name="limitValue" column="limit_value" type="decimal" /> 
     <!-- The unique=true property makes the many-to-one a one-to-one relationship --> 
     <many-to-one name="alertEntity" 
      class="Entity" column="entity_id" 
      not-null="true" cascade="all" unique="true"/> 
     <set name="alert_targets" table="alerts_alert_targets" cascade="all"> 
      <key column="alert_id" /> 
      <many-to-many column="alert_target_id" 
       class="AlertTarget" /> 
     </set> 
    </class> 
</hibernate-mapping> 
+0

プロジェクト内のこれらのファイルはどこにありますか(hibernate.cfg.xmlとAlert.hbm.xml)?どの輸出業者がコードジェネレータで実行しようとしていますか?あなたは正常にHibernate設定を作成し、マッピング/クラスを表示できますか? – Shane

答えて

1

Alert.hbm.xmlの "id"プロパティに "type"が指定されていないということが原因です。

1

は奇妙な。

私はhibernate-reverse.xmlファイルをチェックして、それにつながる可能性のある追加の属性がないかどうかを確認します。

また、生成中に、既存のものを使用するのではなく、hibernate-revenge.xmlとhibernate.cfg.xmlをセットアップしてみてください。

関連する問題