JPG forgeign key name?

I am using the Hibernate Tools ant task to create DDL from annotated JPA objects. With sleep mode annotations, you can specify a foreign key using

@JoinColumn(name = "foo")
@org.hibernate.annotations.ForeignKey(name = "fk_foo")

Is there a clean JPA way to achieve the same?

+3
source share
2 answers

No. JDO is the only persistence specification to define FK names, onUpdate / onDelete actions, etc. JPA (even in JPA2) is just not there.

- Andy ( DataNucleus )

+1
source

Not in the annotation. However, you can set columnDefinition and write the foreign key there.

+1
source

Source: https://habr.com/ru/post/1711906/


All Articles