-->
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.  [ 1 post ] 
Author Message
 Post subject: @javax.persistence.Foreignkey#name does not change contraint
PostPosted: Fri Dec 27, 2013 8:06 pm 
Beginner
Beginner

Joined: Sat Oct 09, 2004 2:35 pm
Posts: 43
Location: Tenerife
I see recently resolved HH-8783 error about foreignkey name not used to generate constraint name like:

Code:
alter table THEME
        add constraint FK_3p4vyqur9je17uaqoh1q4lheb
        foreign key (SUBJECT_ID)
        references THEME;


gets solved like:

Code:
alter table THEME
        add constraint TEM_FK_SUBJECT
        foreign key (SUBJECT_ID)
        references SUBJECT;


but I see this also happens as you use annotations like:

Code:
@JoinTable(name = "THEME_LABEL",
        joinColumns = {
            @JoinColumn(name = "THEME_ID", nullable = false,
                foreignKey = @ForeignKey(name = "TET_FK_THEME"))
        },
        inverseJoinColumns =
            @JoinColumn(name = "LABEL_ID", nullable = false,
                foreignKey = @ForeignKey(name = "TET_FK_LABEL")))
    @ManyToMany(cascade = { CascadeType.MERGE, CascadeType.REMOVE },
        fetch = FetchType.EAGER)

...

The generated code is:

Code:
    alter table THEME_LABEL
        add constraint FK_ospg6ggdu1lgg446y5dw4f3e4
        foreign key (LABEL_ID)
        references LABEL;

    alter table THEME_LABEL
        add constraint FK_3p4vyqur9je17uaqoh1q4lheb
        foreign key (THEME_ID)
        references THEME;


And as you can see, HHH-8783 is not fully solved, yet.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.