How to write composite key mapping for hibernate?

devquora
devquora

Posted On: Feb 22, 2018

 

    1 Answer Written

  •  devquora
    Answered by Kanak

    A composite primary key is one that has many columns at least two. For creating a database MYSQL script is required. Hibernate is an ORM (Object Relations Mapping) tool which is an standard interface of Java Persistence API. To write composite key mapping for Hibernate you can use two annotations which are Embedded ID and IdClass. These annotations help in denoting the primary composite key. First of all, you need to create a database table that constitutes the primary composite key. Then you need to proceed with the project structure and required dependencies. After receiving the hibernate mapping file, run the application and you are done with the mapping.

Related Questions

Please Login or Register to leave a response.

Related Questions

Hibernate Interview Questions

What is Hibernate ?

Hibernate is a free software, which is distributed under GNU Lesser General public license 2.1. It is categorized under the Object Relational Mapping (ORM)...

Hibernate Interview Questions

What is HQL in Hibernate?

HQL is the acronym of Hibernate Query Language.It considers the java objects in a similar way as that of the SQL. It is..

Hibernate Interview Questions

Explain the advantages of Hibernate?

Some of the advantages of Hibernate are: It provides Simple Querying of data. An application server is not required to..