How To Solve Grails Error Repeated column in mapping for entity? on Existing Postgresql Database
-
Hi i have this following Domain in Grails class Customer { static mapping = { table 'customer' // version is set to false, because this isn't available by default for legacy databases version false id column:'customerid' //generator:'identity', } Long customerid Long customergroupid String username String password String name String street String city String province String postcode String country Date dateregistered String balance Long parentid String parentrebate String metapath Long metalevel Integer smsreplystatus Integer status String reversalurl static constraints = { customerid(insert:false,update:false) customergroupid(max: 9999999999L) username(size: 1..20, blank: false) password(size: 1..32, blank: false) name(size: 1..20, blank: false) street(size: 0..50) city(size: 0..20) province(size: 0..20) postcode(size: 0..5) country(size: 0..20) dateregistered(nullable: true) balance() parentid(max: 9999999999L) parentrebate() metapath(size: 1..255, blank: false) metalevel(max: 9999999999L) smsreplystatus(max: 99999) status(max: 99999) reversalurl(size: 0..50) } String toString() { return "${customerid}" } } i have current database with existing data, and has mapping to GORM with GRAG but i'm getting this error Caused by: 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: postgresql.Customer column: customerid (should be mapped with insert="false" update="false") ... 23 more Caused by: 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: postgresql.Customer column: customerid (should be mapped with insert="false" update="false")
-
Answer:
Had same problem, remove "Long customerid" This may not be a workable solution but at least the app compiles and creates the table. Have not investigated at all as I just managed to get this working -- perhaps when setting a custom identity column, the property definition is implied (thus the "repeated column..." error)
user544296 at Stack Overflow Visit the source
Related Q & A:
- How To Solve Informatics Olympiad?Best solution by sirupsen.com
- How To Solve Problems Creatively?Best solution by Quora
- how to solve functional equation?Best solution by Mathematics
- How to solve the “Your search cannot be completed because of a service error” error in Search Center?Best solution by SharePoint
- How to solve Identifier Undefined error?Best solution by e2e.ti.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.