I have a simple questions. How can I give a name to the Foreign Key relations that arise from the @ ManyToOne annotation ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are interested in naming the column used in the foreign key, one may specify the name of the column used to create the foreign key, using the
@JoinColumnannotation along with the@ManyToOneannotation. The value of thenameattribute of the@JoinColumnannotation is used by the JPA provider to map the column name in the table to the entity’s attribute.However, the name of the foreign key constraint created itself cannot be configured. At the time of writing this, it is not possible to specify the name of the foreign key constraint using a JPA annotation or configuration parameter in the OR mapping files. If you need to change the name of the foreign key constraint, then you must create the DDL statement yourself, instead of relying on the JPA provider to do this.