Hola foreros, tengo el sgte codigo que funcioan perfectamente si genero todo, pero me crea un campo version y otro de id de formualrio:
class Formularios {
String clave
String grupo
String tipo
static constraints = {
}
}
el problema es que no queiro que aparezca esos 2 campos de id y version y mirando por ahi encontre esto:
class Formularios {
String clave
String grupo
String tipo
static constraints = {
}
static mapping = {
table 'formularios'
version false
columns {
id column:'clave_formulario'
grupo_tematico column:'grupo_tematico'
tipo_formulario column:'tipo_formulario'
}
}
}
Pero me salta un error al ejecutarlo:
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: clases.Formularios column: clave(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: clases.Formularios column: clave(should be mapped with insert="false" update="false")