いくつかのドメイン クラス ( User
、Role
、UserRole
など) を含むプラグイン プロジェクトを作成しました。メイン プロジェクトからこれらのドメイン クラスにアクセスできます。
ドメイン クラスをメイン プロジェクトUser
のドメイン クラスにマップしようとすると、マッピング例外が発生します。JobInfo
2 つのドメイン クラス間のマップ:
このドメイン クラスはメイン プロジェクトにあります。
class JobInfo {
String jobName
String jobOutput
User submittedByUser
static constraints = {
jobName(nullable:false, maxSize:255)
jobOutput(nullable:true,type:"text")
submittedByUser (nullable:true)
}
static mapping = {
version false
}
}
このドメイン クラスは Plugin プロジェクトにあります。
class User {
String username
String email
String firstname
String lastname
String password
boolean enabled
boolean accountExpired
boolean accountLocked
boolean passwordExpired
static constraints = {
username(unique:true)
password blank: false
email email: true, blank: false,unique:true
}
static mapping = {
password column: 'password'
datasource "auth"
version false
}
}
マッピング例外を下回っています:
013-05-27/14:57:51.622 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error executing bootstraps: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table job_info refers to an unmapped class: com.test.domain.User
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is **org.hibernate.MappingException: An association from the table job_info refers to an unmapped class: com.test.domain.User**
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table job_info refers to an unmapped class: com.test.domain.User
... 5 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.MappingException: An association from the table job_info refers to an unmapped class: com.test.domain.User
... 5 more
Caused by: org.hibernate.MappingException: An association from the table job_info refers to an unmapped class: com.test.domain.User
... 5 mor