@javax.persistence.Foreignkey#name does not change contraint name

Description

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;
...
}

Attachments

1

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 !

Fixed

Details

Assignee

Reporter

Labels

Components

Fix versions

Affects versions

Priority

Created December 9, 2013 at 5:51 PM
Updated April 22, 2015 at 6:24 PM
Resolved December 9, 2013 at 8:29 PM