@javax.persistence.Foreignkey#name does not change contraint name
Description
Attachments
1
is duplicated by
relates to
Activity
Show:

Matthias Müller January 31, 2014 at 12:26 PM
Great, tnx!

Brett Meyer January 23, 2014 at 8:56 PM
, yep, I'll address that in 5.0 under

Matthias Müller January 23, 2014 at 8:36 PM
Ups, sorry for the duplicate issue linking

Matthias Müller January 23, 2014 at 8:27 PM
Hi ,
unfortunately @Foreignkey still doesn't seem to work together with @JoinColumns (plural) with Hibernate 4.3.1. See JPA Spec 11.1.26, or am I missing something?
Regards
Matthias

NoDataFound January 16, 2014 at 9:32 AM
Okay. I will let the annotation, expecting it to work correctly in 5.0 !
Renaming a foreign key constraint using the JPA2.1 @javax.persistence.ForeignKey annotation does not change the constraint name. The provider default name is still used.
Using the (now deprecated) @org.hibernate.annotations.ForeignKey does work in the same environment.
Basic usage:
import javax.persistence.ForeignKey;
@Entity
public class Task implements Serializable
{
...
@JoinColumn(name = "query_id", nullable = false, foreignKey = @ForeignKey(name = "fk_task_query"))
private Query query;
...
}