-->
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: Multiple Composite attributes in one embedded class fails
PostPosted: Wed Mar 14, 2007 2:51 pm 
Beginner
Beginner

Joined: Wed Jul 14, 2004 11:51 am
Posts: 43
I also posted this thread in the Java Persistence (EntityManager and Annotations), Hibernate Search and Hibernate Validator forum:

Hello,

I'm currently refactoring my application to work with annotations but am encountering a problem when I have a class with 2 composite attributes in an embedded class:

Code:
@javax.persistence.Embeddable
@javax.persistence.MappedSuperclass
public class ArticleLocalization
        implements org.dataisland.primitives.bean.Localization, Serializable {
...

    private org.dataisland.primitives.datatype.Blob binaryContent;

@org.hibernate.annotations.Type(type="org.dataisland.primitives.hibernate.BlobHibernateType")
    @javax.persistence.Embedded
    @javax.persistence.AttributeOverrides( {
            @javax.persistence.AttributeOverride(name="content", column = @javax.persistence.Column(name="BINARY_CONTENT_CONTENT") ),
            @javax.persistence.AttributeOverride(name="contentType", column = @javax.persistence.Column(name="BINARY_CONTENT_CONTENTTYPE") ),
            @javax.persistence.AttributeOverride(name="contentFileName", column = @javax.persistence.Column(name="BINARY_CONTENT_FILENAME") )
    } )
    public org.dataisland.primitives.datatype.Blob getBinaryContent() {
        return this.binaryContent;
    }
    public void setBinaryContent(org.dataisland.primitives.datatype.Blob value) {
        this.binaryContent = value;
    }



    private org.dataisland.primitives.datatype.Blob representation;
    @org.hibernate.annotations.Type(type="org.dataisland.primitives.hibernate.BlobHibernateType")
    @javax.persistence.Embedded
    @javax.persistence.AttributeOverrides( {
            @javax.persistence.AttributeOverride(name="content", column = @javax.persistence.Column(name="REPRESENTATION_CONTENT") ),
            @javax.persistence.AttributeOverride(name="contentType", column = @javax.persistence.Column(name="REPRESENTATION_CONTENTTYPE") ),
            @javax.persistence.AttributeOverride(name="contentFileName", column = @javax.persistence.Column(name="REPRESENTATION_FILENAME") )
    } )
    public org.dataisland.primitives.datatype.Blob getRepresentation() {
        return this.representation;
    }
    public void setRepresentation(org.dataisland.primitives.datatype.Blob value) {
        this.representation = value;
    }


...
}


As you can see the class refers to two blobs which have different columns but (obviously) the same name.

Whey hibernate reads the mappings, I get this exception:

org.hibernate.MappingException: Repeated column in mapping for collection: ca.illi.article.closable.entities.ClosableArt
iclePlaceHolder.closableArticleSummaryLocalizations column: content

Does anyone know what I'm missing? If I remove one of the 2, it works fine. Seems to complain about columns being the same when the names are obviously different by my attribute overrides (?)

Any help would be greatly appreciated,

Thanks

François


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.