How to rename primary key constraint using JPA?

Viewed 302

Is there any way I can rename primary key constraint in spring jpa ?

I am using Oracle database, but it renames primary key constraint by SYS_C followed by some random number, I want to give it a custom name like instance_details_pkey. Please refer to this image constraint_names

2 Answers

Assuming that your DDL is handled by Spring-Data and subsequently Hibernate, what you seek to do is not possible out of the box. There is in fact an open request to implement something like this for Hibernatem which can be found here.

As mentioned in an another answer, you could go ahead and do something custom that could handle this, but I would advise against it. In fact, I would advise against even using Hibernate to create the default schema.

Related