-->
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.  [ 5 posts ] 
Author Message
 Post subject: Problem with including an Embeddable Component twice
PostPosted: Thu Nov 16, 2006 3:35 am 
Newbie

Joined: Mon Nov 21, 2005 6:15 am
Posts: 14
Hibernate version: 3.2.0

Hi,
If you have an Embeddable component two times in a class, I am getting the error Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: tavant.twms.domain.claim.PartsClaim column: referred_inventory_item (should be mapped with insert="false" update="false") even after setting attribute overrides values

Code:
class A {
    @Embedded
    C someRef;
}

class B extends A {
    @Embedded
    @AttributeOverrides (...override to point to different columns...)
    C someOtherRefInstance;
}

class C {
    String name;
}

Now class B that extends A has two instances of embeddable object from it. I am having a SingleTable Hierarchy inheritance. I ensured that AttributeOverrides points to different columns. Am I missing something here? Or is it a bug?


Top
 Profile  
 
 Post subject: JIRA request
PostPosted: Thu Nov 16, 2006 4:05 am 
Newbie

Joined: Mon Nov 21, 2005 6:15 am
Posts: 14
Is this related to the JIRA request,
http://opensource.atlassian.com/project ... se/HBX-815 ? I am following the annotation doc at http://www.hibernate.org/hib_docs/annotations/reference/en/html/entity.html#d0e492


Top
 Profile  
 
 Post subject: Naming Strategy
PostPosted: Fri Nov 17, 2006 4:03 am 
Newbie

Joined: Mon Nov 21, 2005 6:15 am
Posts: 14
I am using the ImprovedNamingStrategy. I tried hacking around with the methods a custom improved strategy extending improved naming strategy, but of less use.


Top
 Profile  
 
 Post subject: Re: Problem with including an Embeddable Component twice
PostPosted: Fri Nov 17, 2006 7:21 pm 
Newbie

Joined: Fri Oct 20, 2006 2:35 pm
Posts: 1
Location: Oregon
I just ran into the same issue. We're using duplicated embedded components elsewhere, overriding to point at different columns, but they have @Basic mappings, not entity references. The one we need to duplicate that has an entity reference is causing the same mapping exception. Hibernate 3.2.0 GA.


Top
 Profile  
 
 Post subject: Resolution
PostPosted: Mon Nov 20, 2006 3:53 am 
Newbie

Joined: Mon Nov 21, 2005 6:15 am
Posts: 14
Hibernate annotations comes with a DefaultComponentSafeNamingStrategy (that extends EJB3NamingStrategy) this can be used to fix this issue. However, I noticed that this tries to change most column names (foreign keys, collection table names) etc.

This will be an issue for us since we have most test data in excel sheets (with column names specified).

I just created my own ComponentSafeStrategy which sorta appends field names for component (or EmbeddedObject) references. Here again you need to change column names (in case you had some test data for your test cases) only for embedded objects (not foreign keys etc).

It seems to work, although it took some time in fixing all column names in excel sheets :)


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

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.