I have created a new domain object in an existing Grails 1.3.7 project.
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}"
}
}
This class links to the 'Implement' class.
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}"
}
}
When I run grails run-app through the windows command prompt I get the following errors:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 's essionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.h ibernate.MappingException: An association from the table exercise refers to an unmapped class: com.xfitlog.Implement ... 28 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 exercise refers to an unmapped class: com.xfitlog.Implement ... 28 more Caused by: org.hibernate.MappingException: An association from the table exercise refers to an unmapped class: com.xfitlog.Implement ... 28 more Application context shutting down...
I have tried creating a new project and adding these same domain classes and everything works fine. I don't know what has changed in my original project but something is messed up.
Thank you for your help.
grails clean
? – zoran119grails-app/domain
and that the class packages match the directories. – ataylor