既存のGrails 1.3.7プロジェクトで新しいドメインオブジェクトを作成しました。新しいドメインオブジェクトを追加する際のGrailsマッピングエラー
package com.xfitlog
class Implement {
String name
String description
String abbreviation
static belongsTo = [exercise : Exercise]
static constraints = {
name(nullable: false, unique: true)
description(nullable: false, maxSize: 2000)
abbreviation(nullable: true)
}
String toString() {
"${name}"
}
}
このクラスは「実装」クラスにリンクしています。 org.springframework.beans.factory.BeanCreationException:によって引き起こさ
:名前の 作成中にエラーが発生しまし豆
class Exercise{ String name String description boolean isApproved Implement implement static constraints = { name (nullable: false) description (nullable: false, maxSize: 5000) isApproved (nullable: true) implement (nullable: true) } String toString() { "${name}" } }
私はGrailsの実行アプリを窓から実行するコマンドプロンプト私は、次のエラーを取得します'transactionManager':beanプロパティ ' essionFactory'を設定中に、 'sessionFactory'というBeanへの参照を解決できません。入れ子になった例外は ですorg.springframework.beans.factory.BeanCreationException:エラー 名前 'sessionFactory'でBeanを作成しています:initメソッドの呼び出し が失敗しました。ネストされた例外はorg.h ibernate.MappingExceptionです:テーブルの運動から 関連がマップされていないクラスを参照: com.xfitlog.Implement ... 28もっとによって引き起こさ:org.springframework.beans.factory.BeanCreationException:エラー 'sessionFactory'という名前のBeanを作成しています:initメソッドの呼び出し が失敗しました。入れ子になった例外はorg.hibernate.MappingExceptionです: テーブル演習からの関連付けは、マップされていないクラスを参照しています: com.xfitlog.Implement ... 28詳細原因:org.hibernate.MappingException:マップされていないクラスに: com.xfitlog.Implement ...シャットダウンする28以上のアプリケーション・コンテキスト...
私は新しいプロジェクトを作成し、これらの同じドメインクラスを追加し、すべてが正常に動作しようとしています。私は元のプロジェクトで何が変わったのか分かりませんが、何かが混乱しています。
ありがとうございました。
あなたは 'grails clean'を試しましたか? – zoran119
ドメインクラスが 'grails-app/domain'にあり、クラスパッケージがディレクトリと一致することを確認してください。 – ataylor
私はグレイスを何度も動かしました。ドメインクラスは、正しく機能しているすべての古いクラスと同じパッケージとディレクトリにあります。 – user1172234