I would like to know how to create a Composite Combination through Hibernate annotation method. 

I have 3 tables Employee, Department &amp; Employee-Department-Juntion

Since I want to make Employee and Department as individual table, i created a Junction Table in order maintain the Many-to-Many relationship.

I would like to know how to Create Composite Primary Key for the Department Table
For the column Center_Code &amp; Depart_Code through Hibernate Annotations.

Could you please somebody help me how to solve this issue.

Below Here I also attached the Table Relation Ship and the Java POJO Class.

Table Relationship



JAVA POJO CLASS

package com.hibernate;

import java.util.Objects;
import javax.persistence.Entity;
import javax.persistence.Id;

/**
 *
 * @author SPAR
 */
@Entity
public class Department {

    @Id
    private String cost_Center_Code;
    private String dep_Code;
    private String department;
    private String sub_Department;
    private String division;

    public String getDepartment() {
        return department;
    }

    public void setDepartment(String department) {
        this.department = department;
    }

    public String getDep_Code() {
        return dep_Code;
    }

    public void setDep_Code(String dep_Code) {
        this.dep_Code = dep_Code;
    }

    public String getCost_Center_Code() {
        return cost_Center_Code;
    }

    public void setCost_Center_Code(String cost_Center_Code) {
        this.cost_Center_Code = cost_Center_Code;
    }

    public String getDivision() {
        return division;
    }

    public void setDivision(String division) {
        this.division = division;
    }

    public String getSub_Department() {
        return sub_Department;
    }

    public void setSub_Department(String sub_Department) {
        this.sub_Department = sub_Department;
    }

    @Override
    public String toString() {
        return "Department{" + "cost_Center_Code=" + cost_Center_Code + ", dep_Code=" + dep_Code + ", department=" + department + ", sub_Department=" + sub_Department + ", division=" + division + '}';
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 79 * hash + Objects.hashCode(this.cost_Center_Code);
        hash = 79 * hash + Objects.hashCode(this.dep_Code);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Department other = (Department) obj;
        if (!Objects.equals(this.cost_Center_Code, other.cost_Center_Code)) {
            return false;
        }
        if (!Objects.equals(this.dep_Code, other.dep_Code)) {
            return false;
        }
        return true;
    }

}



Question: Why am I getting a redefinition error?
Answer: remove the body

class RenderingEngine1 : public IRenderingEngine {
public:
...
    void OnRotate(DeviceOrientation orientation) {}
...
-&gt;   void OnRotate(DeviceOrientation orientation);