FK « Annotation « JPA Q&A

1. Hibernate. How can we set name of PK/FK using annotations?

We have hibernate-based system and customer wants to get human-readable names of PK and FK. In our project we use annotated entity classes. Is it renaming possible?

2. Migrate to Hibernate Annotations from plain hibernate configuration - Also Database needs FK

Currently I have following scenario with my project :

  • Implemented Hibernate Configuration files (xml) mapping
  • Database doesn't have any FK relationship yet
So Now I wanna know that what are the things I need ...

3. Self referencing join on FK using annotations.

Hibernate version: Database: IDS 7.3 I need to outer join a table (Product) to its self using a foreign key. I can do this in SQL and through hibernate using native SQL but I would like to be able to do it in HQL. To achieve this I need add a self referencing mapping on the entity but I have ...