When trying to run command grails run-app --stacktrace
, grails is throwing this error :
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 java.lang.ClassCastException: org.grails.datastore.mapping.model.MappingFactory$10 cannot be cast to org.grails.datastore.mapping.model.types.ToMany
I commented static hasMany
from all the domain classes but error still persisted, until I replaced it with hibernate3 in my build.gradle
How can I solve this using hibernate4?
I found the solution, actually it had to do with embedded grails domain property
.