Foreign key « Annotation « JPA Q&A

1. JPA: Give a name to a Foreign Key on DB?

I have a simple questions. How can I give a name to the Foreign Key relations that arise from the @ ManyToOne annotation ?

2. Foreign key using hibernate Annotation

Hi. I have two tables say Table1 and Table2. -->Table1. has 1 PK(type_id), 1 unique key(code), and 1 Fk (Parent_id), this FK is referencing the PK in this same table. -->Table2 has 1 PK(id), and 1 FK(type_id) that is referencing the PK of the "Table1". For these two tables I have 2 java classes, and I am using Hibernate Annotations in ...