-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: org.hibernate.MappingException: Repeated column in mapping
PostPosted: Tue Mar 08, 2011 12:39 pm 
Newbie

Joined: Tue Mar 08, 2011 12:19 pm
Posts: 1
I am getting the following exception when initializing my service...
[INFO] [grails.bat] Error executing script TestApp: 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: BookmarkGadget column: gadgets_id (should be mapped with insert="false" update="false")

Here is what my class looks like...
Code:
class BookmarkGadget extends BaseGadget{
    Integer gadgetsId
    Blob urlData   
    String url
   
    static mapping = {
        table 'gadget_bookmark'
        id column:'id', sqlType:int //added for mysql
        version sqlType:int
        gadgetsId column:'gadgets_id', sqlType:int
        urlData type:'blob'
        gadgets cascade:'all'
    }


I am not sure what this exception is trying to tell me? I searched my code and this is the only place that the gadgetsId mapping is defined.
If I take out the "Integer gadgetsId" then the exception goes away, but then I get an exception that the gadgets_id column is a int when hibernate is expecting a bigint.
I added the "gadgetsId column:'gadgets_id', sqlType:int" and "Integer gadgetsId" to tell hibernate that my MySQL database has the column defined as int instead of a bigint.
This fix has worked for other INT(11) columns on different tables, but doesn't seem to work for the gadgets_id column. Any ideas why?
All I need to do is tell hibernate that the column is a int not a bigint.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.