@ForeignKey naming with TABLE_PER_CLASS inheritance
---------------------------------------------------
Key: ANN-801
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-801
Project: Hibernate Annotations
Issue Type: Bug
Affects Versions: 3.3.1.GA
Reporter: Maciej Szulik
First sample code (I've omitted irrelevant parts):
@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):
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.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira