-->
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.  [ 3 posts ] 
Author Message
 Post subject: AssocOverr.joinTable not working with mapped superclass
PostPosted: Tue Feb 08, 2011 8:23 am 
Newbie

Joined: Tue Feb 08, 2011 7:18 am
Posts: 2
Hi,

I'm using Hibernate 3.6.1.Final with Spring 3.0.5.RELEASE via org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean. I'm not able to override the join table name for a one-to-many association using AssociationOverride.joinTable when my entity extends a mapped superclass where this association is declared.

I'm trying to do something like this:

Code:
@MappedSuperclass
public abstract class TreeItem<T extends TreeItem<T>> {
   
    @OneToMany(fetch = FetchType.LAZY)
    @JoinTable (
          name = "parent_child",
          joinColumns = @JoinColumn(name = "parent_id"),
          inverseJoinColumns = @JoinColumn(name = "child_id"))
    private Collection<T> children= new HashSet<T>();
      
}

@Entity
@Table(name = "purpose")
@AssociationOverride(name = "children",
      joinTable =  @JoinTable(name = "purpose_children",   
            joinColumns = @JoinColumn(name = "parent_id"),
            inverseJoinColumns = @JoinColumn(name = "child_id")))
public class PurposeCode extends TreeItem<PurposeCode>{
   
   @Id
   private Long id;

}


But hibernate generates only the parent_child table and not the purpose_children one as I suppose.

I have several other entities to extend TreeItem and everyone from them has its own separate join table.

I've googled around the net and also search in JIRA but I didn't find any notice this should not work. What am I doing wrong?

_________________
peto:)


Top
 Profile  
 
 Post subject: Re: AssocOverr.joinTable not working with mapped superclass
PostPosted: Tue Apr 12, 2011 12:54 pm 
Beginner
Beginner

Joined: Thu May 05, 2005 4:49 pm
Posts: 30
Did you ever find an answer to this?


Top
 Profile  
 
 Post subject: Re: AssocOverr.joinTable not working with mapped superclass
PostPosted: Wed Apr 13, 2011 1:17 am 
Newbie

Joined: Tue Feb 08, 2011 7:18 am
Posts: 2
No, I didn't. I just declare the children attribute and it's mapping in subclasses.

_________________
peto:)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.