-->
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.  [ 2 posts ] 
Author Message
 Post subject: @ForeignKey naming with TABLE_PER_CLASS inheritance
PostPosted: Wed Jan 21, 2009 5:06 am 
Newbie

Joined: Tue Jan 20, 2009 3:25 am
Posts: 6
Location: Poland
I'm using Hibernate 3.2.5.GA, but also tried 3.3.1.GA (with Oracle database and JDBC ver. 11.1.0.6.0) and I'm having problem when naming foreign keys.
First sample code (I've omitted irrelevant parts):

Code:
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@SequenceGenerator(name = "SEQ", sequenceName = "SEQ_OBIEKTY")
public abstract class AbstractObject implements Serializable {

  @ManyToOne
  @JoinColumn(name = "CREATE_BY")
  @ForeignKey(name="FK_CB_")
  @Index(name = "_CB_I")
  protected User createBy;

  // ... other fields
       
}

@Entity
public class User implements Serializable {

  // ... user fields

}

@Entity
public class Object1 extends AbstractObject {

  // ... specialized Object1 fields

}


When I generate ddl from this model it looks like this (only the foreign key part and index):
Code:
  alter table Object1
     add constraint FK_CB_72cf927c
      foreign key (CREATE_BY)
      references User;

  create index Object1_CB_I on Object1 (CREATE_BY);


My problem is, when I'm trying to name foreign key in abstract class, the generated foreign key name is: prefix given in @ForeignKey's name annotation plus some random hex number. But analogical index naming results in index name according to: table_name + suffix given in @Index's name annotation. Can anyone explain this to me? Is it a bug, or am I missing something?

Regards,
Maciej


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 05, 2009 9:44 am 
Newbie

Joined: Tue Jan 20, 2009 3:25 am
Posts: 6
Location: Poland
I filled jira issue for this ANN-801.


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