Issue Type: Bug Bug
Assignee: Unassigned
Created: 15/Jun/12 11:30 AM
Description:

A bug in hibernate creates duplicated foreign key constraints when generates a ddl script using hibernate tool or Noemalife DDL Generator. This happens when the model has a hierarchy with subclasses that extend the superclasse using generics.
Example (using JPA):
@MappedSuperclass
public abstract class AbstractPersonRelationship<T extends AbstractEntity> extends AbstractEntity

@Entity
public class PersonRelationship extends AbstractPersonRelationship<Person>

@Entity
public class PersonPractitionerBinding extends AbstractPersonRelationship<Practitioner>

WIth hbm2ddl in the ddl script I have:

alter table PSN_PRACTITIONER_BINDING
add constraint FK_PSNPRACT_PRACT_TARGET
foreign key (TARGET_ID_PRACT)
references PSN_PERSON;

alter table PSN_PRACTITIONER_BINDING
add constraint FK_PSNPRACT_PRACT_TARGET
foreign key (TARGET_ID_PRACT)
references PSN_PRACTITIONER;

In PersonRelationhip the constraint is not duplicated...

Project: Hibernate Tools
Priority: Major Major
Reporter: Luca Pedriali
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira