-->
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: @AttributeOverride works in @Entity, not @MappedSuperclass?
PostPosted: Tue Jan 31, 2006 7:54 pm 
Newbie

Joined: Fri Mar 25, 2005 1:16 pm
Posts: 13
Hibernate version: 3.1.1 w/ Annotations 3.1beta8

Is AttributeOverride only for use on leaf classes? I have 3 levels of inheritance, say Foo<-Bar<-[X and Y]. I have a property in Foo that I want to override the size for in Bar, so it affects X and Y, but not everything else that extends Foo. However, as of right now, I have to use the AttributeOverride declaration in both X and Y, which are both @Entity. It has no effect when used in Bar, which is @MappedSuperclass - the values from Foo are used instead.

Is this by design, or is this something that should be supported?

Thanks
John


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 4:59 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
show me a simplified failing mapping

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 11:47 am 
Newbie

Joined: Fri Mar 25, 2005 1:16 pm
Posts: 13
Code:
@MappedSuperclass
public class BaseAuditedExternalIdItem extends AuditedIdItem implements ExternalItem {
    private String _externalId;
   
    @Column(name="externalId", nullable=false, length=30)
    public String getExternalId() {
        return _externalId;
    }
}


Code:
@MappedSuperclass
//doesn't work//@AttributeOverride( name="externalId", column = @Column(nullable=false, length=50) )
public abstract class WorkOrderUpdate extends BaseAuditedExternalIdItem {

}


Code:
@Entity
@AttributeOverride( name="externalId", column = @Column(nullable=false, length=50) )
public class OrderUpdate extends WorkOrderUpdate  {
}


Code:
@Entity
@AttributeOverride( name="externalId", column = @Column(nullable=false, length=50) )
public class LoadUpdate extends WorkOrderUpdate {
}


I'd like to just have the AttributeOverride in WorkOrderUpdate, since I want it to be 50 in both LoadUpdate and OrderUpdate. However, I could only get it to work when overriding in LoadUpdate and OrderUpdate, not WorkOrderUpdate. (When I say "work", I mean getting 50 as the column length from AnnotationConfiguration.getTableMappings().)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 8:13 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
open a JIRA issue, I'll look at that. A patch fixing it would be even better :-)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 03, 2006 7:27 pm 
Newbie

Joined: Fri Mar 25, 2005 1:16 pm
Posts: 13
emmanuel wrote:
open a JIRA issue, I'll look at that. A patch fixing it would be even better :-)


Okay - I didn't want to open a JIRA issue if that was in the spec or something. I'll see about it Monday, though I haven't looked much at the Annotations code much yet.


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.