hibernate - Grails Mapping error when adding a new domain object -
hibernate - Grails Mapping error when adding a new domain object -
i have created new domain object in 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 '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 run grails run-app through windows command prompt next errors:
caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'transactionmanager': cannot resolve reference bean 'sessionfactory' while setting bean property 's essionfactory'; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': invocation of init method failed; nested exception org.h ibernate.mappingexception: association table exercise refers unmapped class: com.xfitlog.implement ... 28 more caused by: org.springframework.beans.factory.beancreationexception: error creating bean name 'sessionfactory': invocation of init method failed; nested exception org.hibernate.mappingexception : association table exercise refers unmapped class: com.xfitlog.implement ... 28 more caused by: org.hibernate.mappingexception: association table exercise refers unmapped class: com.xfitlog.implement ... 28 more application context shutting down...
i have tried creating new project , adding these same domain classes , works fine. don't know has changed in original project messed up.
thank help.
make sure you're not mixing hibernate hbm.xml classes domain objects. got similar error , turned out issue.
my current app mixes old style groovy pojo ( java pojo written in groovy) using hiberate mapping files in library , domain classes in main project.
also create sure of domain classes have right import , bundle statements.
hibernate grails
Comments
Post a Comment