|
Hello to all.
Can I map a view in database (as "create view lol") to a model in grails? I'm trying to do it with a view named nivel_docente. The mapping struct is: static mapping = { table "nivel_docente" version false id column: "docente_id" nivel_id column: "nivel_id" data_efetivacao column: "data_efetivacao" } and the attributes are: Integer docente_id Integer nivel_id Date data_efetivacao But when I try to run the app, I get the follow error: 2010-09-22 21:56:49,066 [main] ERROR context.GrailsContextLoader - Error executing bootstraps: Error creating bean with name 'messageSource': 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: Repeated column in mapping for entity: mercurio.NivelDocente column: docente_id (should be mapped with insert="false" update="false") org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': 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: Repeated column in mapping for entity: mercurio.NivelDocente column: docente_id (should be mapped with insert="false" update="false") I think proprably I need to configure something in hibernate configure files. How can I do it? Is it possible to do it in the grails' layer? Thx --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Problem resolved.
You just need do add the code insertable:'false',updatable:'false' in every the columnn mapping. 2010/9/22 Leandro Santiago <[hidden email]>: > Hello to all. > > Can I map a view in database (as "create view lol") to a model in grails? > > I'm trying to do it with a view named nivel_docente. > > The mapping struct is: > > static mapping = { > table "nivel_docente" > version false > id column: "docente_id" > nivel_id column: "nivel_id" > data_efetivacao column: "data_efetivacao" > } > > and the attributes are: > > Integer docente_id > Integer nivel_id > Date data_efetivacao > > But when I try to run the app, I get the follow error: > > 2010-09-22 21:56:49,066 [main] ERROR context.GrailsContextLoader - > Error executing bootstraps: Error creating bean with name > 'messageSource': 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: Repeated > column in mapping for entity: mercurio.NivelDocente column: docente_id > (should be mapped with insert="false" update="false") > org.springframework.beans.factory.BeanCreationException: Error > creating bean with name 'messageSource': 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: Repeated > column in mapping for entity: mercurio.NivelDocente column: docente_id > (should be mapped with insert="false" update="false") > > I think proprably I need to configure something in hibernate configure > files. How can I do it? Is it possible to do it in the grails' layer? > > Thx > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Powered by Nabble | Edit this page |
