i have the following domain-class-entity:
class AccountSupplier {
static mapping = {
table 'MY_TABLE'
version false
// references-column-mapping
accountReference: column:'REFACNTID'
supplierReference column:'REFSUPID'
// primary / foreign keys
id generator: 'assigned', column: 'REFACNTID'
id generator: 'assigned', column: 'REFSUPID'
}
Account accountReference
Supplier supplierReference
static constraints = {
accountReference(insert:false, update:false, nullable:false)
supplierReference(insert:false, update:false, nullable:false)
}
}
which should image a real table in an oracle database (already existing and contains thousands of records.
when i want to start grails i get the following exception:
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: AccountSupplier column: REFSUPID (should be mapped with insert="false" update="false")
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory.doCreateBean(ReloadAwareAutowireCapableBeanFactory.java:105)
What is wrong with this? do i need to modify the related entities? Cant i make a foreign key to a primary key?
Thanks